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

て烟熏妆下的殇ゞ 提交于 2019-12-23 10:14:20

问题


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)


回答1:


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



回答2:


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.



来源:https://stackoverflow.com/questions/24436928/r-cmd-build-skips-knitr-rmd-vignettes-outputs-listed-in-build-vignette-rds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!