简体   繁体   English

带R包的CSV的运输目录

[英]ship directory of CSVs with R package

I have contributed several import functions to R package , which batch read in CSVs from specifically structured directories (such as this ). 我为R package贡献了几个导入功能,这些功能从特定结构化的目录(例如this )中以CSV批量读取。

To give users an example, I'd like to ship such a directory structure of CSVs with the package. 举个例子,我想在软件包中附带这样的CSV 目录结构 Since these are import functions, it obviously makes no sense to include the data as ready-made *.rda . 由于这些是导入功能,因此将数据包含为现成的*.rda显然是没有意义的。

So I did this: 所以我这样做:

  1. add the directory (with subdirectories) ("keyneson") to inst/ . 将目录(带有子目录)(“ keyneson”)添加到inst/
  2. document it with a keyneson.rd in man/ as if it were a normal *.rda dataset. 使用man/keyneson.rd对其进行keyneson.rd ,就好像它是普通的*.rda数据集一样。

R CMD check passes without notes/warnings. R CMD check通过,没有注释/警告。

Is this ok? 这个可以吗? Will CRAN accept this? CRAN会接受吗? Is there a better way? 有没有更好的办法?

Jennifer Bryan suggested on twitter that I should use /inst/extdata (as @Dason suggested) and place an Rdata into /data/ . 詹妮弗·布赖恩Jennifer Bryan)Twitter上建议我应该使用/inst/extdata (如@Dason所建议) 并将Rdata放在/data/

She did the same for her package , which made it past CRAN. 她为自己的包裹做过同样的事情,这使它超越了CRAN。

That's what I did, too, works fine. 我所做的也很好。 No complaints from R CMD check . 没有R CMD check投诉。

使用devtools::use_data(your_data, overwrite = TRUE)将数据文件保存到data/文件夹,它应该可以工作。

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

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