renv::install() without updating dependencies

I'd like to add a package to the lock file. However, renv::install() wants to update dependencies that are already installed to newer versions. This isn't necessary for the package to work so I'd prefer to skip those updates. Is this possbible? renv::install(exclude =) doesn't seem to help here.

One option, if all you want to do is update the lockfile, would be to use renv::record() -- for example,

renv::record("dplyr")

would add the latest-available version of dplyr to the lockfile, without changing or updating any dependencies.

It's important to use this function with care since it's possible to create lockfiles with incompatible dependencies in this way, but it can be useful if you need to perform "surgery" on an existing lockfile.

1 Like

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.