0

Could you please help me?

I'm building an R package for the final assignment of Coursera's Building R Packages.

So far, I've followed all steps to add a vignette described in the courses's readings, chapter 16.7 of R Markdown Cookbook, and chapter 11 of R Packages, which are basically:

First, add a vignette with:

usethis::use_vignette("mypackage")

Second, edit the YAML heading of the RMD file created in the directory vignettes.

Third, edit the content of the vignette.

However, after installing and loading the package, the vignette cannot be found using the command:

browseVignettes("mypackage")

I get this error:

No vignettes found by browseVignettes("mypackage")

My package is already available in this GitHub repo, if you want to take a look at the files.

What is missing, please? Thanks!

Marco
  • 347
  • 3
  • 18

1 Answers1

0

Meanwhile, I found the solution here: How to Add a Vignette to a Package in RStudio

It all boils down to installing the package from its source file instead of installing it directly from the package's directory.

As explained in the link provided above, the vignette is only built this way:

Open your package's project file (.Rproj) in RStudio;

Go to Build>Build Source Package;

Close the project and RStudio;

Go to Tools>Install Packages;

In Install From, select Package Archive File;

In Package Archive, browse for the source file (.tar.gz).

Click on Install;

In RStudio's console, look for the vignette with:

browseVignettes("mypackage")
Marco
  • 347
  • 3
  • 18
  • A link to a solution is welcome, but please ensure your answer is useful without it: [add context around the link](//meta.stackexchange.com/a/8259) so your fellow users will have some idea what it is and why it’s there, then quote the most relevant part of the page you're linking to in case the target page is unavailable. [Answers that are little more than a link may be deleted.](/help/deleted-answers) – Sabito stands with Ukraine Nov 04 '20 at 16:27