In a package I'm developing with R Studio, I create vignettes via devtools::use_vignette("mydoc.Rnw")
, which gives a standard vignette header like
---
title: "Title"
author: "Michael Friendly"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Title}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
I have followed all the instructions in http://yihui.name/knitr/demo/vignette/ and http://r-pkgs.had.co.nz/vignettes.html. The vignettes are listed on the CRAN page for the package, yet they seem inaccessible in an R session with the package loaded.
> browseVignettes("matlib")
No vignettes found by browseVignettes("matlib")
> library(tools)
> names(vignetteEngine(package = 'matlib'))
Error in getEngine(name, package) :
None of packages ‘matlib’ have registered vignette engines
I know that other packages with knitr
-processed .Rmd vignettes are accessible from the package, but can't figure out why mine are not.
What is missing?
My vignettes/
directory contains only the .Rmd files (no PDFs), but that seems the same as, e.g., https://github.com/yihui/knitr/tree/master/vignettes.
use roxygen to generate vignettes
box in configure build tools and are you building the vignettes when you install the package? – rawruse roxygen to generate vignettes
box checked, andBuild & reload
now generates HTML files in thevignettes/
directory. However, I still getNo vignettes found by browseVignettes("matlib")
. – user101089vignettes/*.html
be added to.gitignore
or.Rbuildignore
? – user101089devtools::build_vignettes()
. This moved thevignettes/*.html
files toinst/doc
and addedinst/doc
to.gitignore
. – user101089