Skip to content

Instantly share code, notes, and snippets.

@aculich
Created February 12, 2026 01:00
Show Gist options
  • Select an option

  • Save aculich/8fda2891471c6c9b5a0bfae193929da8 to your computer and use it in GitHub Desktop.

Select an option

Save aculich/8fda2891471c6c9b5a0bfae193929da8 to your computer and use it in GitHub Desktop.

How to handle package upgrades with rollback as an option?

The safest approach: lock your project with renv

This gives you a per-project package library + a lockfile, so you can update without irreversably wrecking your packages and so you can roll back instantly.

In your project directory:

install.packages("renv")
renv::init()          # creates renv/ + renv.lock, uses a project library

Then install your set (including GitHub packages) into the project library:

renv::install(c(
  "skimr", "data.table", "zipcodeR", "qs", "tidyverse",
  "janitor", "lubridate", "tigris"
))

renv::install("timathomas/colorout")
renv::install("irworkshop/campfin")

renv::snapshot()      # writes exact versions to renv.lock

If you update later and something breaks:

renv::restore()       # returns you to the last snapshot

What to do right now at the update prompt

If you don’t have renv set up yet and you’re worried about global changes:

  • Choose “3: None” to skip upgrades for now.
  • Then set up renv and reinstall inside the project (so updates are isolated).

If you do need to get past this install and don’t want to skip, the next-lowest-risk choice is typically:

  • “2: CRAN packages only” (less chaotic than “All”, because GitHub packages can change faster)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment