如何在 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.
假设 DICTIONARY 是一个数据集.
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?
推荐答案
来自 R-exts.pdf (在线来源):
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屋!