From the Writing R Extensions Manual, I read that
As from R 2.14.0 the preferred location for the Sweave sources is the subdirectory vignettes of the source packages, but for compatibility with earlier versions of R, vignette sources will be looked for in inst/doc if vignettes does not exist.
However, when I create a vignettes
subdirectory of the package source, when I run devtools::check()
or R CMD check
I get a warning for Package vignette(s) without corresponding PDF
. If I put the vignette (.Rnw and .pdf) in inst/doc
the check completes without complaints. I tried looking in my library at installed packaged and did not see any directories named vignettes
. Should I still use the deprecated location?
You put the .Rnw
sources in vignettes/
as you did, but you missed out a critical step; don't check the source tree. The expected workflow is to build the source tarball and then check that tarball. Building the tarball will create the vignette PDF.
R CMD build ../foo/pkg
R CMD check ./pkg-0.4.tar.gz
for example will build a source package tarball from the sources in ../foo/pkg
creating the .tar.gz
package in the current directory with the package name and version appended. Then you run R CMD check
on that source package.
If you want your vignette built for you put it in vignettes/
and build the source package. At some future date, R Core may remove the ability to build vignettes from inst/doc
so go with the advised location now and avoid check the sources directly.