How do I remove packages from renv lock file?

My team uses renv for package management. I think we have a bunch packages we no longer need in our lock file, and I would like to remove them but I am not sure how.

  1. How can I see what packages have been saved our our renv lock file?
  2. How can I easily remove packages from the lock file?

I found the official documentation from renv not very helpful on this front. Thanks in advance for the advice.

renv.lock is a human readable JSON text.
You can use library(jsonlite) to easily parse it, and extract the package names

library(jsonlite)
sort(names(fromJSON("renv.lock")$Packages))

to remove packages use the renv::remove() function

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.