R CMD INSTALL --build package --> "vignettes missing"
Asked Answered
T

1

6

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.

Trainor answered 3/9, 2013 at 9:7 Comment(0)
P
3

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.

Philomena answered 4/9, 2013 at 22:20 Comment(4)
Yes, this makes a lot of sense. But I am building a binary, and from the output on the screen, the package seems to be installed from source as part of this process, but if the source is not already packaged in a .tar.gz file, the source is installed without including the vignettes, even if they are available in the vignettes folder in my "working package source" as .pdf files. So what I would like to know is if there is a way of forcing vignettes files to be included in the .zip file other than by using the .tar.gz for the install.Trainor
@PedroAphalo How are you building the zip?Philomena
Through the RStudio menu "Build > More > Build binary package" with no extra switch added in project options, in which case RStudio sets the library correctly to my local user library for the install. The same happens when opening a Windows shell from within RStudio and executing the commands above, or when using a windows shell from outside RStudio and setting the Paths for Rtools and adding the --library switch. I prepared a minimal example. It is available at bitbucket as a public repository.Trainor
My message was misleading, I think. Further checking shows that if I copy the vignette's .pdf file to the package's inst/doc folder it gets included in the binary. R CMD build builds the vignettes but puts them in inst/doc in the copy of the package that is installed in the library. R CMD INSTALL --build <dirname> builds the binary from the sources, not from the installed library so doesn't find any file in inst/doc. R CMD INSTALL --build <source.tar.gz> is a copy of the build installed in a library, so contains the .pdf file generated from the .Rnw located in the vignettes folder.Trainor

© 2022 - 2024 — McMap. All rights reserved.