How to automatically load data in an R package?

2019-01-15 05:38发布

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?

标签: r package
1条回答
Explosion°爆炸
2楼-- · 2019-01-15 06:26

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
查看更多
登录 后发表回答