user
user

Reputation: 1140

Vignette in Package Documentation

I wrote a vignette for an R package of mine. It is built without any errors, using both devtools::built() and the tool built into RStudio with the vignettes option selected. The html output file is placed in the vignettes directory, but it does not show up in the list printed by vignette(all = T) and the User guides, package vignettes and other documentation link is not added to the documentation.

As recommended on this site, I already reinstalled the package using devtools::install(), made sure that the directory is called vignettes, and checked whether the vignettes were excluded in .Rbuildignore (it contains ^.*\.Rproj$ and ^\.Rproj\.user$).

This is the (anonymized) header of the Rmd file:

---
title: "Introduction to my package"
author: "John Doe"
date: "May 23, 2021"
output: rmarkdown::html_vignette
bibliography: ../inst/REFERENCES.bib
vignette: >
  %\VignetteIndexEntry{Introduction to my package}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = F}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

Is there any other setting that requires modification?

Upvotes: 3

Views: 749

Answers (1)

Gowachin
Gowachin

Reputation: 1270

I have a solution, from here. You need to force installation of the vignette when installing your package.

Example with local package :

remotes::install_local(build_vignettes = TRUE, force = TRUE)

Example where the package is on github :

remotes::install_github('account/repository', build_vignettes = TRUE, force = TRUE)

force = TRUE is here because we already have the last version of the package and force installation

I bet you can set this option in Rstudio, but haven't found it yet.

Upvotes: 3

Related Questions