如何自动在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
而不是data(DICTIONARY)
使其加载.我该怎么做呢?
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):
"data"子目录用于数据文件,使其可用 通过延迟加载或使用data()加载. (由 "DESCRIPTION"文件中的"LazyData"字段:默认为 这样做.)
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
这篇关于如何自动在R包中加载数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!