Export data to Roxygen2 so that it is accessible without requiring data ()

After reading questions like this SO question for documenting a dataset with Roxygen , I managed to document the dataset (which I will call cells ), and now it appears in the list generated by data(package="mypackage") , and loads if I run the data(cells) command. After that, cells will appear when ls() run.

However, in many packages, data is immediately available without calling data() . Also, data names are not displayed when ls() run. An example is the baseball dataset that comes with plyr . I looked at the source for plyr and I do not see how this is done.

+7
source share
1 answer

In the DESCRIPTION file of your package, make sure that there is a field named LazyData that is set to TRUE .

In the guide "Writing R-Extensions":

The data subdirectory is for data files that should be accessible through lazy loading or for loading using data (). (A selection is made of the "LazyData" field in the "DESCRIPTION" file: by default, do not do this.)

I think the exact syntax has changed from R version 2.14; before that he was LazyLoad, not LazyData.

+8
source

All Articles