I want to include a dataset in a package I'm building. I followed all the steps in this primer.
- Create a data subdirectory and save the dataset as
myPackage/data/this_dataset.Rdata
- Create a
.R
file withRoxygen2
comments, saved asmyPackage/R/this_dataset-data.R
- Include the line
LazyData: true
in theDESCRIPTION
file.
Then I install it:
> library("devtools")
> setwd("D:/workspace/myPackage")
> install()
Installing aPackage
Skipping 1 package ahead of CRAN: data.table
"C:/PROGRA~1/R/R-32~1.3/bin/x64/R" --no-site-file --no-environ --no-save --no-restore CMD INSTALL \
"D:/workspace/myPackage" --library="C:/Users/aUser/Documents/R/win-library/3.2" --install-tests
* installing *source* package 'aPackage' ...
** R
** data
*** moving datasets to lazyload DB
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (aPackage)
Reloading installed aPackage
So it looks like it figured out that there are datasets.
But then I can't get the dataset to load. print(this_dataset)
should work with lazy loading but returns "object not found" error. data(this_dataset)
returns "data set not found." I do: data(package='aPackage')
and get no data sets found
.
What am I doing wrong?