I have built an rmarkdown tutorial for an R package, and would like to include the compiled file when the package is built. Though the file compiles happily (including when I use R CMD Sweave
to do so), I don't seem to be able to include it in a binary.
Specifically, when I run R CMD BUILD
I get
* checking for file ‘./DESCRIPTION’ ... OK
[snip]
* installing the package to build vignettes
* creating vignettes ... OK
* checking for empty or unneeded directories
Removed empty directory ‘rentrez/inst/doc’
Removed empty directory ‘rentrez/inst’
Removed empty directory ‘rentrez/vignettes/assets’
Removed empty directory ‘rentrez/vignettes’
* building ‘rentrez_0.2.4.tar.gz’
But after installing this binary and running vignette(package="rentrez")
there are no vignettes for the package.
So, what am I doing wrong?
If it helps, this branch of the library contains the vignettes and associated edits to the package. The file itself is in vignettes/
directory and starts with
<!--
%\VignetteEngine{knitr::knitr}
%\VignetteIndexEntry{rentrez tutorial}
-->
The DESCRIPTION file includes these lines
Suggests:
testthat,-
VignetteBuilder: knitr
EDIT
I should have thought to run R CMD CHECK
on the built package:
Output(s) listed in 'build/vignette.rds' but not in package:
‘inst/doc/rentrez_vignette.html’
As far as I can tell, build/vignette.rds
is created by R CMD BUILD
, but I don't why it points to inst/doc
(even if this dir is deleted before the package is built)
The problem is that you have rentrez_*
in your .Rbuildignore
and that matches the name of your vignette. Lines in .Rbuildignore
should look like
^staticdocs$
not
staticdocs
You should remove inst/doc/
. All vignettes are supposed to be under vignettes/
only. Another thing to keep in minds is that you should only keep source documents under vignettes
, and all generated files should not be there, eg the HTML output. Although it is certainly not the best example, you can always check how knitr builds its own vignettes .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.