0

I am trying to add a package's vignette and have it show up in its documentation when I use usethis functions 1.4.0.9000 and devtools 2.0.1 in RStudio 1.1.463. I made a new package with usethis and set the license then added a generic vignette:

setwd("~/Desktop")
usethis::create_package("blah")
usethis::use_gpl3_license("me")
usethis::use_vignette("a-vignette")

I tweaked the vignette gently so it would knit. I comment out the library call and add some text to a blank last line of the vignette :

```{r setup}
#library(blah)
```

Hello World

and then checked it works by using the Knit button and it Knits and displays the HTML page.

I use the Build tab More menu and chose Document and it says:

Updating blah documentation 
Loading blah 
Documentation complete

There is no mention of the vignette. So I am thinking this is only working in the man folder...

I then use the Build menu Install and Restart button and then open the package documentation (in the packages windowpane) it does not say anything about the vignette.

So I tried using:

devtools::build_vignettes()

and it gives me feedback that makes sense:

Building blah vignettes
Moving a-vignette.html, a-vignette.R to doc/
Copying a-vignette.Rmd to doc/
Building vignette index

But again when I install and Restart the documentation has no mention of the vignette.

So, how do I have a vignette show up as a link in its package documentation?

itsMeInMiami
  • 2,324
  • 1
  • 13
  • 34
  • I _think_ this comes from installing from the working directory. If you create a source release, _i.e._ create a `.tar.gz` file, and install from that the vignette should get added. – Dirk Eddelbuettel Dec 27 '18 at 17:31
  • Thanks for the idea. I made a binary and installed from that and it was missing from that as well. – itsMeInMiami Dec 27 '18 at 19:26
  • 1
    That a _binary_, that is different. _Source_ package is what you want. – Dirk Eddelbuettel Dec 27 '18 at 19:29
  • Lovely! That works. Is there a way to have R vignettes listed when I build my package locally or if I share the binary? Is this a design decision (or a flaw) in the refactoring or devtools? I can't imagine why somebody would not want their vignettes listed as part of the package documentation. What am I missing here? – itsMeInMiami Dec 27 '18 at 20:31
  • I see that you are very beholden to `usethis` and its helpers, so I invite you to check there. I take "Writing R Extensions" as the definining manual, and I am not sure it says it. But a general recommendation is to create a `tar.gz` (as I recommended to you) and install from that. Now, why `install.packages()` does not rebuild vignettes from a source directory I do not know either -- I "just" know how to get my vignettes installed :) – Dirk Eddelbuettel Dec 27 '18 at 20:44

0 Answers0