What's the best way to update renv.lock based on internal RStudio Package Manager


Here is my goal: update package versions in renv.lock using rstudio package-manager as the source.

Issue: I could not see a convenient way from renv to do that

renv::update seems to be the right function, but it looks at CRAN and GitHub at this point and does not provide ways of explicitly providing a url to internal package repository.

Question: What's the best way to manage package updates in renv.lock when your source is not CRAN, GitHub or a local file system?

There isn't a convenience function for doing this right now, but in theory, since renv.lock is just JSON, you could do something like:

  1. Set your R repository to point to RSPM; e.g. with options(repos = <RSPM URL>),
  2. Request available packages + their versions,
  3. Read the renv lockfile (as JSON),
  4. For each package record, update the version based on the version seen in (2),
  5. Write the lockfile back out.

The main thing you'd need to be careful of is whether the dependencies required by different packages changed. You might ultimately just want to file a feature request at Issues · rstudio/rstudio · GitHub.

Thanks @kevinushey! Before posting, I tried something along these lines but I must have done something not correctly as it failed. I'll give this a shot and if this is already not on the roadmap, I'd be happy to put in a feature request.
Thanks for this great package!!

This topic was automatically closed 21 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.