Difference between inst/doc/ and doc/

Hi all,
I am writing some .Rmd vignettes for my package under the vignettes/ directory. From what I've read I believed that the built vignettes would go to inst/doc/ but instead, the vignettes are moved to doc/ when I run devtools::build_vignettes().

Could someone explain the difference between these two folders? Should I move doc/ back to inst/? Is this something that changed recently?

:wave: @lucha6! Why are you building the vignettes with devtools::build_vignettes() by the way? In the R packages book it is written that it is often not useful. In any case in the same book there is a diagram showing that "inst/doc" becomes "doc" when the package goes from the bundled to the binary state.

Hello again @maelle, I guess I know now why not use build_vignettes() on its own after reading your answer to my comment in GitHub. My question is now, where should my vignettes be, should they just be left in vignettes/ and then they will be turned into readable formats (HTML or PDF) at the installation step? Also what do browseVignettes() and vignette() search for, do they look for inst/doc or doc/?

To my defence I did not realize right away you were the same person, at least you can see I am consistent in my answers. :joy:

So, if you want your users or yourself to browse vignettes

  • I think adding a pkgdown website is 100% worth the effort. Also because it allows you to add custom grouping to the reference. And because it means all the docs are browsable without installing the package.
  • From GitHub you can write the line that the users would need to type to install the vignette. Yes you just need to have the vignettes in vignettes/ as created by e.g. usethis::use_vignette(). Also, be careful to list all vignette dependencies in DESCRIPTION (as Suggests if they are not used elsewhere).
remotes::install_github("owner/repo", build_vignettes = TRUE)

As far as I understood, browseVignettes uses the vignette index of the installed package so vignettes that are in a doc folder.

This topic was automatically closed after 45 days. New replies are no longer allowed.


If you have a query related to it or one of the replies, start a new topic and refer back with a link.