2

I'm using Rstudio and devtools to build vignettes for an R packge.

All vignettes are in the /vignettes directory. However, when I run R CMD check I get a warning:

> checking files in 'vignettes' ... WARNING
  Files in the 'vignettes' directory but no files in 'inst/doc':
    'my_package_vignette.Rmd'

I can use devtools::build_vignettes() to build each vignette, but it does not create a copy of the vignette in inst/doc, where I understand browseVignettes("my.package") will look.

I would like my vignettes to be discoverable by `browseVignettes("my.package").

I found this issue, and this "solution":

tools::buildVignettes(dir = ".", tangle=TRUE)
dir.create("inst/doc")
file.copy(dir("vignettes", full.names=TRUE), "inst/doc", overwrite=TRUE)

Unfortunately, when I run R CMD check in Rstudio, it erases the inst/doc directory.

I have seen this issue, but none of the solutions resolve my question.

How do I build package vignettes in Rstudio so that they are discoverable by browseVignettes()?

zdebruine
  • 3,687
  • 6
  • 31
  • 50
  • In the past I've had success using `devtools::install(build_vignettes = TRUE)` – dario Oct 13 '21 at 11:58
  • @dario I've read that elsewhere, and it may have worked in the past, but as of right now that isn't building vignettes into the `inst/doc` directory. – zdebruine Oct 13 '21 at 23:28

0 Answers0