R CMD INSTALL --build package --> “vignettes missing”

折月煮酒 提交于 2019-12-08 19:34:22

问题


Problem: C:\>Rcmd.exe INSTALL --build --library=C:/Users/local_aphalo/Documents/R/win-library/3.0 photobiology

C:\>Rcmd.exe INSTALL --build --library=C:/Users/local_aphalo/Documents/R/win-library/3.0 photobiology_0.2.6.tar.gz

The first command (as used by RStudio) builds a ZIP file that is missing the vignettes.

The second command builds a ZIP that includes the vignettes.

Using R CMD instead of Rcmd.exe makes no difference. The .tar.gz was built immediately before attempting to build the .zip file, from exactly the same source files, from within RStudio (which uses Rcmd.exe build photobiology).

The vignettes are coded in .Snw files using knitr, documentation and NAMESPACE use ROxygen2. The problem happens on all of the packages that I have tried to build, but they are very similarly coded. Only one of them uses Rcpp.

When installing the package for use from within RStudio, installing from .tar.gz installs vignettes just fine. If installing from .zip, whether vignettes get installed or not, depends on whether the .zip files contains them or not (which depends on which of the two commands at the top of this message was used to build the .zip file).

I am using R 3.0.1, and also tried a couple of R 3.0.1 patched builds a few days back. I am mostly using Windows 7 (both 32 bit, and 64 bit), I tried once under Ubuntu 64bit, and the problem is reproducible. I first noticed the problem when using RStudio (0.97 and 0.98) and posted a message in the RStudio forum, but have received no answer in a couple of weeks. I have found at least another relatively old post about this problem in the RStudio website forum, but it has not been answered. Today, I investigated a bit further, and the problem is clearly not related to RStudio, as I can reproduce it through the command line.

The question is: Is this behavior a feature? a bug? or I am missing just an option in the command used?

Of course, I can easily work around the problem at the command line by using the .tar.gz file to build the .zip file, but as I think the preferred way of building a package is by just supplying the package name as argument.

Thanks for any insights on the origin of this problem.


回答1:


I think this is a feature:

  • if you're installing from source, vignettes are always built

  • if you're installing from a binary, they're not built, and will only be available if they were built when the binary was made

This approach means that you can distribute vignettes in binary packages to people who might not be able to build them from source.



来源:https://stackoverflow.com/questions/18588227/r-cmd-install-build-package-vignettes-missing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!