简体   繁体   中英

How to automatically load data in an R package?

This is likely an easy answer that's been answered numerous times. I just lack the terminology to search for the answer.

I'm creating a package. When the package loads I want to have instant access to the data sets.

So lets say DICTIONARY is a data set.

I want to be able to do DICTIONARY rather than data(DICTIONARY) to get it to load. How do I go about doing this?

From R-exts.pdf ( online source ):

The 'data' subdirectory is for data files, either to be made available via lazy-loading or for loading using data(). (The choice is made by the 'LazyData' field in the 'DESCRIPTION' file: the default is not to do so.)

Adding the following to the DESCRIPTION file should do it:

LazyData: true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM