On 13/11/2020 1:48 p.m., Gábor Csárdi wrote:
On Fri, Nov 13, 2020 at 6:10 PM Henrik Bengtsson
<henrik.bengts...@gmail.com> wrote:

I'm quite sure you want to use the following:

Suggests: knitr, rmarkdown, formatR
VignetteBuilder: knitr

So this means that WRE is wrong? It says:

> "Note that if, for example, a vignette has engine ‘knitr::rmarkdown’,
> then knitr provides the engine but both knitr and rmarkdown are needed
> for using it, so both these packages need to be in the
> ‘VignetteBuilder’ field and at least suggested (as rmarkdown is only
> suggested by knitr, and hence not available automatically along with
> it). Many packages using knitr also need the package formatR which it
> suggests and so the user package needs to do so too and include this
> in ‘VignetteBuilder’."

Things may have changed since Henrik and I wrote the code, but his description matches my understanding as well (and I think he's contributed more recently than I have).

The way non-Sweave vignettes work is that some packages register themselves to recognize vignette files in the vignettes directory. The default one recognizes .Rnw files as vignettes (and a few other extensions too); the knitr::rmarkdown one recognizes .Rmd files and some others. The only way for a package's registration code to be called is for it to be listed as a VignetteBuilder. See ?tools::vignetteEngine for details of the engine.

The rmarkdown package doesn't register any vignette engines, so it doesn't need to be in VignetteBuilder. Same for formatR.

It's fairly common to have a package only used in the vignette, so you list it in Suggests. But that wouldn't apply only to rmarkdown and formatR, there are lots of other examples. However, I'd guess it's pretty common to forget to include rmarkdown and formatR, since they may not be explicitly used. Then putting them in the VignetteBuilder field will trigger an error if they are not also in Suggests.

Duncan Murdoch



My understanding is that R CMD build (and possibly other
commands/functions as well) checks for the packages in
'VignetteBulider`, this is why you need to include rmarkdown and
formatR as well. See the source code in build.R and e.g.
https://bugs.r-project.org/bugzilla/show_bug.cgi?id=15775 etc.

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to