Short answer is you need more devtools (and devtool-friends) in your life. Specifically, usethis::use_vignettes() will set all this up for you (and other usethis:: functions can set up everything else: travis, codecov and github actions, to adding package dependencies).
Long answer is that the .Rmd vignette mechanism was somewhat 'bolted on' long after good ol Sweave vignettes were well established, so it involves a bit of extra hackery.
First, you were erroneously ignoring .Rmd in .Rbuildignore, preventing R from seeing this file. (usethis updates .Rbuildignore automatically when necessary).
Next, we need to tell R that we're using knitr ad the VignetteBuilder in DESCRIPTION
The way .Rmd was 'bolted on' was to move vignettes to a top-level vignettes directory, and actually never touch inst/doc manually. You'll see it's removed from the sources. Also, we typically don't include the 'output' .html and .R ("purl" aka "tangle" !) files created by building the vignette, so note they are ignored here too.
For building, your method is fine, but try more devtools as well! To speed installation, devtools install methods actually skip vignette building by default (the opposite of R CMD build), but you can toggle this:
@dochvam
Short answer is you need more
devtools
(and devtool-friends) in your life. Specifically,usethis::use_vignettes()
will set all this up for you (and otherusethis::
functions can set up everything else: travis, codecov and github actions, to adding package dependencies).Long answer is that the .Rmd vignette mechanism was somewhat 'bolted on' long after good ol Sweave vignettes were well established, so it involves a bit of extra hackery.
.Rmd
in.Rbuildignore
, preventing R from seeing this file. (usethis
updates.Rbuildignore
automatically when necessary).knitr
ad theVignetteBuilder
in DESCRIPTIONvignettes
directory, and actually never touchinst/doc
manually. You'll see it's removed from the sources. Also, we typically don't include the 'output' .html and .R ("purl" aka "tangle" !) files created by building the vignette, so note they are ignored here too.For building, your method is fine, but try more
devtools
as well! To speed installation,devtools
install methods actually skip vignette building by default (the opposite ofR CMD build
), but you can toggle this:and witness:
This same argument can be passed to
devtools::install_github()
(which is re-exportingremotes::install_github()
) to force the build of the vignettes.