简体   繁体   English

如何自动加载R包中的数据?

[英]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. 所以我们说DICTIONARY是一个数据集。

I want to be able to do DICTIONARY rather than data(DICTIONARY) to get it to load. 我希望能够执行DICTIONARY而不是data(DICTIONARY)来加载它。 How do I go about doing this? 我该怎么做呢?

From R-exts.pdf ( online source ): 来自R-exts.pdf( 在线资料 ):

The 'data' subdirectory is for data files, either to be made available via lazy-loading or for loading using data(). 'data'子目录用于数据文件,要么通过延迟加载提供,要么使用data()加载。 (The choice is made by the 'LazyData' field in the 'DESCRIPTION' file: the default is not to do so.) (可以通过'DESCRIPTION'文件中的'LazyData'字段进行选择:默认情况下不这样做。)

Adding the following to the DESCRIPTION file should do it: 将以下内容添加到DESCRIPTION文件中应该这样做:

LazyData: true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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