So I've got a function that loads an RData workspace and uses the data in a dataframe therein to perform some computation. At the moment I am putting everything into a package and my question is where I should put that workspace/the dataframe in the package and how I should modify my function to point to it.
我有一个函数,它加载一个RData工作区并使用其中的dataframe中的数据执行一些计算。此时,我正在将所有内容放入一个包中,我的问题是应该将工作区/ dataframe放在包中的什么位置,以及应该如何修改函数以指向它。
1 个解决方案
#1
2
Sec. 1.1.6 of the Writing R extensions manual describes exactly what you are looking for.
书写R扩展手册的1.1.6节详细描述了您正在寻找的内容。
The
data
subdirectory is for data files, either to be made available via lazy-loading or for loading using data(). [...]data子目录用于数据文件,可以通过延迟加载获得,也可以使用data()加载。[…]
Data files can have one of three types as indicated by their extension: plain R code (.R or .r), tables (.tab, .txt, or .csv, see ?data for the file formats, and note that .csv is not the standard19 CSV format), or save() images (.RData or .rda). [...]
数据文件可以有三种类型之一,其扩展名是plain R code(。R或。R),表格(。选项卡,.txt,或. CSV,查看文件格式的数据,注意。CSV不是标准的CSV格式),或保存()图像(。RData或.rda)。[…]
#1
2
Sec. 1.1.6 of the Writing R extensions manual describes exactly what you are looking for.
书写R扩展手册的1.1.6节详细描述了您正在寻找的内容。
The
data
subdirectory is for data files, either to be made available via lazy-loading or for loading using data(). [...]data子目录用于数据文件,可以通过延迟加载获得,也可以使用data()加载。[…]
Data files can have one of three types as indicated by their extension: plain R code (.R or .r), tables (.tab, .txt, or .csv, see ?data for the file formats, and note that .csv is not the standard19 CSV format), or save() images (.RData or .rda). [...]
数据文件可以有三种类型之一,其扩展名是plain R code(。R或。R),表格(。选项卡,.txt,或. CSV,查看文件格式的数据,注意。CSV不是标准的CSV格式),或保存()图像(。RData或.rda)。[…]