简体   繁体   English

R CMD检查错误:如何摆脱Windows上devel R包中的隐藏文件和目录?

[英]R CMD check error : how to get rid of hidden files and directory in devel R package on windows?

I am building my R package on Rstudio, and I am running R CMD check for my packages. 我正在Rstudio上构建我的R包,我正在运行R CMD检查我的包。 However, R CMD check warn few issues that possibly result in error. 但是,R CMD检查警告几个可能导致错误的问题。 I checked my project home directory, indeed some files was hidden, now I set them up visible. 我检查了我的项目主目录,确实隐藏了一些文件,现在我将它们设置为可见。 Just out of curiosity, how to stop exist .gitignore, .Rproj.user, .git in my package directory ? 出于好奇,如何在我的包目录中停止存在.gitignore, .Rproj.user, .git R CMD check complain about these, because these files are not properties of packages, and also not being R package structure convention. R CMD检查抱怨这些,因为这些文件不是包的属性,也不是R包结构约定。 How can I get rid of these warning in my Packages ? 如何在我的包裹中摆脱这些警告? I tried to create dummy packages on my machine, but these properties always show up in package home directory, why this is happen when building R package with Rstudio ? 我试图在我的机器上创建虚拟包,但这些属性总是显示在包主目录中,为什么在使用Rstudio构建R包时会发生这种情况? How can I fix this CMD check error ? 如何修复此CMD检查错误? Any idea please ? 有什么好主意吗?

According to writing R Extension manual, R package structure supposed to be : 根据R Extension手册的编写,R包结构应该是:

myPackage
 `- inst
     `- extdata
             `- data1.csv
             `- data2.csv
 `- R
    `- ...
 `- NAMESPACE
 `- man
     `-hello.Rd
 `- DESCRIPTION
  • Note : 注意 :

This is session of R CMD check, part of error message as follow : 这是R CMD检查的会话,错误信息的一部分如下:

Found the following executable files: .git/objects/00/bc868b99806415c87749e4a2e060f99eb811da .git/objects/01/10cc76aa5573ca9401e72b36ad3672b39f23cb .git/objects/01/5c9910f52a0560426a1b00e1e31e1f060afdfb .git/objects/03/0ca1ef161838ebeb6a225f354a6a8eec95e472 .... ... 找到以下可执行文件:.git / objects / 00 / bc868b99806415c87749e4a2e060f99eb811da .git / objects / 01 / 10cc76aa5573ca9401e72b36ad3672b39f23cb .git / objects / 01 / 5c9910f52a0560426a1b00e1e31e1f060afdfb .git / objects / 03 / 0ca1ef161838ebeb6a225f354a6a8eec95e472 ....

  .git/objects/fd/6439dfc6532e7e3a76e76b3e4ca4fd683b2c5e
  .git/objects/fd/ebc184b447002ee6239231093eb026b9bb3aec
  .git/objects/fe/02f64dd278d70ff2e5fb212834d131bc23fddb
  .git/objects/ff/15763b397945d0ee2e2523eab1bfd460f84529
  .git/objects/ff/5413a4dc5f2710fe30ad14f4eb10992ad5aee4
  .git/objects/ff/b8e86c018008d3cee09871f76df3a7277cb1c7
Source packages should not contain undeclared executable files.
See section 'Package structure' in the 'Writing R Extensions' manual.
* checking for hidden files and directories ... NOTE
Found the following hidden files and directories:
  .gitignore
  .Rproj.user
  .git
These were most likely included in error. See section 'Package
structure' in the 'Writing R Extensions' manual.

inst/ must be created in my package home directory, but I don't have this property when I am building my packages. inst /必须在我的包主目录中创建,但是在构建包时我没有这个属性。 Why I missed this directory ? 为什么我错过了这个目录? Can any one point me how to possibly solve this problem ? 谁能指出我如何解决这个问题呢? How can I fix this CMD check error ? 如何修复此CMD检查错误? Thanks in advance :) 提前致谢 :)

You are (likely) doing it wrong. 你(可能)做错了。 Do the following: 请执行下列操作:

cd ..
R CMD build yourDirectory/
R CMD check yourPackage_0.1.0.tar.gz

as the creation of the source tarball will automatically exclude the internal directories you want skipped. 因为源tarball的创建自动排除您想要跳过的内部目录。 Which is why checking against tarballs (rather than directories) is the recommended and documented approach. 这就是为什么检查tarball(而不是目录)是推荐和记录的方法。

Note that in RStudio the option in the Build tag is called 'Check' and does just that: create a tarball first (after possibly running roxygen or other steps as configured) and then checks the tarball for you. 请注意,在RStudio中,Build标记中的选项称为“Check”并执行此操作:首先创建一个tarball(在可能运行roxygen或配置的其他步骤之后),然后为您检查tarball。 That is as easy as clicking one button, or typing Ctrl-Shift-E (on my platform). 这就像单击一个按钮或键入Ctrl-Shift-E(在我的平台上)一样简单。

Finer control of additional files to exclude can be obtained via the .Rbuildignore file which tells R which other files to skip. 可以通过.Rbuildignore文件获得对要排除的其他文件的更好控制,该文件告诉R要跳过哪些其他文件。 A number of files and directories are already implicitly declared that way, including the git directories. 许多文件和目录已经以这种方式隐式声明,包括git目录。

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

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