Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R CMD build skips knitr/Rmd vignettes - "Output(s) listed in 'build/vignette.rds' but not in package"

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)

like image 785
david w Avatar asked Jun 26 '14 17:06

david w


1 Answers

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
like image 82
hadley Avatar answered Oct 27 '22 08:10

hadley