0

Even though I duly setwd() (within an R session running in an Emacs/ESS buffer) to the root of my R package and run devtools::load_all() there, when I call a function I find that I am running a version of the function that no longer exists in the present R package. Running rm(<function_name>), followed by source-ing the relevant file, do not help.

Might I perhaps be running a version of the package that I inadvertently installed?, I ask myself. I run lapply(.libPaths(), dir) to answer, but my package does not appear.

What is happening? Where/how is this caching happening?

Update

Running

rm(list=ls())

as described here solved the problem. Although it's not clear what the problem might have been in the first place. An explanation is very welcome.

Vrokipal
  • 784
  • 5
  • 18
  • 1
    There's not really enough here to tell what's going on. Some sort of [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) would be helpful. Or show exactly what you are seeing in the console that makes the problem more clear. Show the code you are running. – MrFlick Apr 09 '18 at 14:42
  • 2
    It's unclear what exactly you are doing but `setwd()` has no place in package code. – Roland Apr 09 '18 at 14:43
  • Also run `search()` and maybe `find(your_function)` to see what's on your search tree and where the function is being found. – Gregor Thomas Apr 09 '18 at 15:21

1 Answers1

0

R caches your global environment in a file .Rdata. Delete it and start a new session.

Vrokipal
  • 784
  • 5
  • 18