{renv}

The {renv} documentation and vignettes have lots of information on {renv}. We’ll point out the most relevant pages and links, because {renv} can be used for a wide variety of uses on different systems (local machine, Docker, etc.).

Vignettes

Introduction to {renv}

This vignette overviews what {renv} is, and how to use it.

It walks us through the workflow of {renv}:

  • Call renv::init() to initialize a new project-local environment with a private R library,
  • Work in the project as normal, installing and removing new R packages as they are needed in the project,
  • Call renv::snapshot() to save the state of the project library to the lockfile (called renv.lock),
  • Continue working on your project, installing and updating R packages as needed.
  • Call renv::snapshot() again to save the state of your project library if your attempts to update R packages were successful, or call renv::restore() to revert to the previous state as encoded in the lockfile if your attempts to update packages introduced some new problems.

It also outlines important caveats:

  • {renv} only solves one small part of the reproducible problem: recording the version of R and R packages that are used in a project

It does not help if a package version becomes no longer available in the future.

It also does not help if a system dependency is missing on the computer attempting to recover an {renv} environment. The system dependency is external and needs to be installed for the project to run successfully.

Collaborating with {renv}

How do you share your project that has an {renv} environment with other people? This vignette walks through the details of collaborating with other users when you have an isolated environment.

{renv} FAQ

Frequently asked questions about {renv}, a great place to start when troubleshooting {renv}.

Videos

{renv}: Project Environments for R

A video by {renv} author Kevin Ushey, outlining why {renv} is important and how to use it.

{renv} demo

Demo on how to set up {renv} in existing projects with biology professor/statistician.