6

I'm developing a package in R (3.3.2) that has internal data. The data is added to ./R/sysdata.rda via

devtools::use_data(dataset, pkg = 'pkgName', internal = TRUE, overwrite = TRUE) 

Within the package I've added and exported a simple function:

show.R

show = function() {
  print(dataset)
)

I'm installing the package locally:

devtools::install(pkg = 'pkgName', 
              args = paste('--library=', installLocation, sep = ''), 
              reload = TRUE,
              local = FALSE)

Finally, I can call show without problems:

library(pkgName, lib.loc = installLocation)
show()
# ...output as expected

I'm running into trouble when I change the data in sysdata.rda. No matter what I try the ONLY way I can get the new data to load from the installed package is on the initial library() load after I restart R.

I have tried:

detach('package:pkgName', unload = TRUE)
unloadNamespace(pkgName)
remove.packages(pkgName, lib = installLocation)

I have also confirmed that the data in the source location has updated:

load(sysdata.rda) # looks good

Where does internal sysdata get cached and how can I clear it or at least force a refresh?

2
  • Did you figure out the answer to this?
    – jtr13
    Commented Aug 8, 2017 at 15:10
  • 1
    Sorry, no. I didn't have time to work through the issue. I just dealt with it the best I could.
    – gph
    Commented Aug 8, 2017 at 21:44

1 Answer 1

0

You need to document and install the package in a clean R session for sysdata.rda to be properly refreshed.

Answering as I had the same problem just now and arrived at this page when looking for a solution.

Not the answer you're looking for? Browse other questions tagged or ask your own question.