Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in browseVignettes: no vignettes found

I'm trying to see the vignette that I've created after rebuilding a package on my local computer. Note that this has nothing to do with suggestions on this post, since I'm not cloning from Github.

The vignettes portion of my vignette file looks like this:

vignette: >
  %\VignetteIndexEntry{pack_name}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}

The process is:

  1. Ctr + Shift + K to knit the vignette

  2. Ctr + Shift + B to rebuild the package

  3. Enter browseVignettes("package name")

Get error: No vignettes found by browseVignettes

I also tried changing knitr::markdown to knitr::knitr, but it didn't help.

Entire vignette top-portion:

---
title: "Random title"
author: "Author"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{vignette_name}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---
like image 336
matsuo_basho Avatar asked Mar 25 '18 14:03

matsuo_basho


1 Answers

You don't give all the details to say what went wrong, but here is what you need to do:

  1. Vignettes need to be in the package vignettes directory.
  2. If they are anything but Sweave vignettes (and yours is knitr::rmarkdown, according to the header lines you showed us), then you need to tell R about it in the DESCRIPTION file. For your example, you'd need VignetteBuilder: knitr in that file, and also have knitr listed in the Suggests, Depends, or Imports lines.
  3. You need to follow the naming convention for your vignette engine. For knitr::rmarkdown, name the file something.Rmd.
  4. You don't need to knit the file yourself. R will do that when it builds the source package. (You can configure RStudio to do this for "Install and Restart"; by default it doesn't.) Even if you haven't knitted the vignette, browseVignettes should find it if you've followed the other steps properly, it just won't display the HTML or PDF output, only the source and extracted R code.

Edited to add: When building and reinstalling the package, it appears that sometimes vignettes aren't included unless the install is done from a .tar.gz file. Use the "Build Source Package" option in the RStudio build pane to get one of those.

like image 93
user2554330 Avatar answered Sep 22 '22 03:09

user2554330