简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM