Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. However, R CMD check warn few issues that possibly result in error. 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 ? R CMD check complain about these, because these files are not properties of packages, and also not being R package structure convention. 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 ? How can I fix this CMD check error ? Any idea please ?

According to writing R Extension manual, R package structure supposed to be :

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 :

Found the following executable files: .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. Why I missed this directory ? Can any one point me how to possibly solve this problem ? How can I fix this CMD check error ? Thanks in advance :)

like image 954
Andy.Jian Avatar asked Dec 03 '16 17:12

Andy.Jian


1 Answers

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. Which is why checking against tarballs (rather than directories) is the recommended and documented approach.

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. That is as easy as clicking one button, or typing Ctrl-Shift-E (on my platform).

Finer control of additional files to exclude can be obtained via the .Rbuildignore file which tells R which other files to skip. A number of files and directories are already implicitly declared that way, including the git directories.

like image 52
Dirk Eddelbuettel Avatar answered Sep 28 '22 04:09

Dirk Eddelbuettel