How to add vignette.html (or .R) files to a github-rep

After using the function "devtools::build_vignettes() " the vignette .html and .R files are created and stored in the folder "doc". However, this folder does not exist on the github repository, which reports only the folder "vignettes" containing the .Rmd files. How do I add the .html files built with "build_vignettes" to the github repository, so that users can download the package and the available vignettes files?

hi @VittorioFortino

As I know, you don't need to build your vignettes before build.

If you use the workflow describe by Hadley and Jennifer in there book, users will have the vignettes

bulid_vignettes use the same algorithm that build does. So if you or users build the packages they will have the vignettes

Hope it help

1 Like

Users who install from github will not have the vignettes by default:

Similarly, devtools::install_github() (and friends) will not build vignettes by default because they’re time consuming and may require additional packages. You can force building with devtools::install_github(build_vignettes = TRUE) . This will also install all suggested packages.

I followed the instructions. But is there a way to link the R package to a pre-built vignette.html/pdf file?

devtools::install_github(...,build_vignettes = TRUE) ..does not build the vignette. Is it possible that there is something wrong with the ".Rbuildignore"?

It works for me, with my package kayadata:

remotes::install_github("jonathan-g/kayadata", build_vignettes = TRUE, force = TRUE)

builds the vignette.

remotes::install_github("jonathan-g/kayadata", build_vignettes = FALSE, force = TRUE)

installs the package, but without the vignette.

I use the force argument to force reinstalling with different parameters so I can test the differences (by default install_github will not re-install if the package was already installed from a git commit with the same hash value, so if you have the package installed and then run remotes::install_github('foo/bar', build_vignettes=TRUE), it will not reinstall the package and thus will not build the vignettes. If you add force = TRUE to the arguments, then it will force a reinstall and build the vignettes.