1

I am writing an R package with this vignette title:

---
title: "Adaptive non-parametric learning"
author: "..."
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Adaptive non-parametric learning}
  %\VignetteEngine{knitr::rmarkdown_notangle}
  %\VignetteEncoding{UTF-8}
---

I added rmarkdown_notangle to avoid running the vignette on CRAN, as the full vignette will take an hour to run (even though now I am testing and it takes 2 minutes).

I compile the package with:

Rscript -e "devtools::document();devtools::check();devtools::build();devtools::install();"

The output shows:

...
─  installing the package to build vignettes
✔  creating vignettes (1m 48.8s)
...
✔  checking files in ‘vignettes’ ...
...
✔  checking for unstated dependencies in vignettes ...
✔  checking package vignettes in ‘inst/doc’
✔  checking re-building of vignette outputs (1m 47.9s)
...
─  installing the package to build vignettes
✔  creating vignettes (1m 49.5s)
...
** installing vignettes
** testing if installed package can be loaded
* DONE (PosteriorBootstrap)
Reloading attached PosteriorBootstrap

But the doc/ directory is empty, the inst/doc directory does not exist, and when I import the package, no vignettes are installed:

> library(PosteriorBootstrap)
> browseVignettes(package="PosteriorBootstrap")
No vignettes found by browseVignettes(package = "PosteriorBootstrap")
> vignette("Adaptive Non-parametric learning")
Warning message:
vignette ‘Adaptive Non-parametric learning’ not found

I found this thread that suggests using %\VignetteEngine{knitr::rmarkdown}, which I use, and install_github(..., build_vignettes=TRUE), which I don't since I build it locally.

Where is the vignette output?

miguelmorin
  • 5,025
  • 4
  • 29
  • 64

1 Answers1

0

One solution is to change the default build_vignettes = FALSE in devtools::install():

devtools::install(build_vignettes = TRUE)

Then do browseVignettes(package = "package_name") to show the vignettes, e.g. on a browser if you use R on the command line.

I found the solution from a comment in the thread I quoted, which suggested the same solution for devtools::install_github().

I could not find the vignette output created by devtools::check() and devtools::build().

miguelmorin
  • 5,025
  • 4
  • 29
  • 64