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

2

7

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)

Hunfredo answered 26/6, 2014 at 17:40 Comment(1)
For others browsing here, this might be another useful discussion to read: How to get RStudio to automatically compile R Markdown Vignettes?Tabitha
J
10

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
Juniper answered 27/6, 2014 at 12:11 Comment(1)
Thanks Hadley! Knew it would be a stupid mistake on my end by couldn't uncover itHunfredo
J
4

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, e.g. the HTML output. Although it is certainly not the best example, you can always check how knitr builds its own vignettes.

Jolee answered 26/6, 2014 at 21:10 Comment(1)
Thanks for the clarification Yihui. As per my recent edit, it turns out R CMD is re-creating the inst/doc directory, but not including the rendered file there. Any clue as to what's going on?Hunfredo

© 2022 - 2024 — McMap. All rights reserved.