Installing packages for ‘renv’

code
r
quarto
github
Author

Ruben

Published

June 12, 2024

renv is a R package that allows to create environments, where the user can install and manage packages. This is needed when using a GitHub action, when you want to render quarto document remote.

To use renv it is necessary to install R packages again, even though they are already installed locally. This enables to use GitHub actions to automatically render the Quarto-Project to deploy a GitHub page!

Packages can be installed normally with install.packages('tidyverse'). Afterwards you can check the status of renv with renv::status(). You can also install all necessary packages (e.g. knitr, markdown,…) by renv::install(). If you installed new packages you have to run renv::snapshot(), to add the installed packages to the lockfile. The lockfile holds all the information about the used packages and when the build and deploy action is performed all the packages will be installed.

Output of the build-deploy action on GitHub

For more information on how to use GitHub-actions with Quarto click here!