安装的R github软件包不包含R/sysdata.Rda [英] Installed R github package does not include R/sysdata.Rda

查看:168
本文介绍了安装的R github软件包不包含R/sysdata.Rda的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个R github软件包,可以使用devtools::install_github("jwilliman/ethnicNZ")(或remotes::install_github)成功"安装.在github上,软件包包含使用命令usethis::use_data(ethnic05, internal = TRUE)保存为'R/sysdata.Rda'的内部数据.

I have an R github package that I can 'successfully' install using devtools::install_github("jwilliman/ethnicNZ") (or remotes::install_github). On github the package contains internal data saved as 'R/sysdata.Rda' using the command usethis::use_data(ethnic05, internal = TRUE).

但是,安装后,'../Library/ethnicNZ/R'文件夹中缺少文件'sysdata.rdb'和'sysdata.rdx',当从软件包中运行命令ethnicNZ::find_data()时,我得到了错误Error in ethnicNZ::find_data() : object 'ethnic05' not found. (这些文件存在,如果我直接从本地git安装软件包,则该命令有效).

However, after installation the files 'sysdata.rdb' and 'sysdata.rdx' are missing from the '../Library/ethnicNZ/R' folder, and when running the command ethnicNZ::find_data() from the package I get the error Error in ethnicNZ::find_data() : object 'ethnic05' not found. (These files are present, and the command works if I install the package directly from my local git).

这可能与在包函数中访问sysdata.rda R程序包的构建/安装错误:找不到对象"即使我在R/sysdata.rda 中有它,但都没有一个可接受的答案.希望我的示例可以重现,以便其他人进行故障排除.

This is possibly a similar issue as accessing sysdata.rda within package functions and R Package Build/Install Error: "object not found" even though I have it in R/sysdata.rda, but neither has an accepted answer. And hopefully my example is reproducible enough for others to troubleshoot.

编辑

我刚刚在安装时注意到我收到错误消息

I just noticed on installation I get the error

   Subdirectory 'R' contains invalid file names:
     'sysdata.Rda'

为什么这是无效的,我该如何避免呢?

Why is this invalid, and how can I avoid it?

sessionInfo()
#> R version 4.0.0 (2020-04-24)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 17134)
#> 
#> Matrix products: default
#> 
#> locale:
#> [1] LC_COLLATE=English_New Zealand.1252  LC_CTYPE=English_New Zealand.1252   
#> [3] LC_MONETARY=English_New Zealand.1252 LC_NUMERIC=C                        
#> [5] LC_TIME=English_New Zealand.1252    
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] compiler_4.0.0  magrittr_1.5    tools_4.0.0     htmltools_0.4.0
#>  [5] yaml_2.2.1      Rcpp_1.0.4.6    stringi_1.4.6   rmarkdown_2.1  
#>  [9] highr_0.8       knitr_1.28      stringr_1.4.0   xfun_0.14      
#> [13] digest_0.6.25   rlang_0.4.6     evaluate_0.14

reprex软件包(v0.3.0)创建于2020-06-17 sup>

Created on 2020-06-17 by the reprex package (v0.3.0)

推荐答案

情况很重要!该文件必须名为"sysdata.rda"而不是"sysdata.Rda".

Case matters! The file must be called 'sysdata.rda' not 'sysdata.Rda'.

我发现我以前将数据另存为save(ethnic05, filename = "sysdata.Rda"),后来又改为使用usethis::use_data(ethnic05, internal = TRUE). usethis::use_data保存在先前的文件上,但没有更正扩展名的大小写.在恢复正确的sysdata.rda之前,我必须删除'sysdata.Rda',提交并推送到github.

I discovered that I'd previously saved the data as save(ethnic05, filename = "sysdata.Rda"), then later changed to using usethis::use_data(ethnic05, internal = TRUE). usethis::use_data saved over the previous file but did not correct the case of the extension. I had to delete 'sysdata.Rda', commit and push to github before reinstate the correct sysdata.rda.

https.1.1.5节中所列://cran.r-project.org/doc/manuals/r-release/R-exts.html ,

"R子目录仅包含R代码文件.要安装的代码文件必须...具有扩展名13 .R,.S,.q,.r或.s....两个例外允许:如果R子目录包含文件sysdata.rda.

"The R subdirectory contains R code files, only. The code files to be installed must ... have one of the extensions13 .R, .S, .q, .r, or .s. ... Two exceptions are allowed: if the R subdirectory contains a file sysdata.rda.

这篇关于安装的R github软件包不包含R/sysdata.Rda的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆