Skip to content

Use renv for package management

Martinez, Anthony James requested to merge init-renv into main

Context

This initiates the use of renv in this project. renv is a package manager in R that ensures that package versions used by a project are static and consistent across collaborators. This should give us a much greater sense of reproducibility and should help ensure that this pipeline "just works" across users and across time.

Summary of changes

I did the work of updating packages and initiating the use of renv in the project. This creates 3 files/directories

  1. renv/ - the project library. This is where packages will be installed. More precicely, this will contain shortcuts/pointers to installed packages that point to a global package repository elsewhere on your machine, which holds all the packages used by renv across all your projects.
  2. renv.lock - the lockfile. This is similar to environment.yaml in Python/conda. It contains metadata for all package dependencies for the project. This is what is used to ensure all projects have the same package versions.
  3. .Rprofile - an project-specific R profile. This file runs every time you start R. In this case, it ensures that renv is activated for the project and it helps it run behind the scenes.

Expected results

This should not substantially change your expirience using the pipeline except for the first time using it. It should not affect the results of the pipeline (at lest, it shouldn't affect them dramatically), but there isn't a good way to predict it because we have probably been using different versions of different packages. It is likely that after running tar_make() the pipeline will re-run in its entirety although I am not sure. When planning for testing, assume that it will.

Requested review

  1. If not already, get familiar with renv by at least reading Introduction to renv.
  2. Open the project and do as instructed. I think it will ask you to run renv::restore(). Please keep track of any setup steps you have to do and add them to README.md.
  3. Run targets::tar_make() to re-build the entire pipeline to ensure it is up to date. Let me know if anything unexpected happens.
  4. Make sure README.md is accurate and makes sense.

Merge request reports