R package : make internal data not lazy

389 views Asked by At

I built an R package containing data with devtools (https://hilaryparker.com/2014/04/29/writing-an-r-package-from-scratch/). I put the data in R/sysdata.rda because data are just used by my functions :

use_data(mydf1, mydf2, mydf3, internal = TRUE)
use_data_raw()

I need very fast functions, thus I wrote LazyData: false in the DESCRIPTION file. When I first used my function of the package I got :

library(myPackage)
system.time(myFunction(...))
user  system elapsed 
1.53    0.11    1.66

However when I secondly used the same function with the same inputs I got :

system.time(myFunction(...))
user  system elapsed 
0.05    0.00    0.04

Thus, I guess my internal data were lazy loaded. I also guess that LazyData: false in the DESCRIPTION file is only relative to data in ./data not to internal data (R/sysdata.rda) :

1) Am I correct ?

2) If yes, how can I make internal data not lazy data ?

The 2 following subjects do not answer this issue :

Automatic loading of data from sysdata.rda in package

How do you handle R Data internal to a package?

0

There are 0 answers