user1700890
user1700890

Reputation: 7732

renv - manually overwrite package version in lock file

I cannot fully restore one package in renv lock file, but I am able to install different version of this package. So I wonder if I can manually overwrite package version in lock file. Do I just need to replace version number? Should I change hash as well? What are the consequences?

Upvotes: 3

Views: 1712

Answers (1)

Kevin Ushey
Kevin Ushey

Reputation: 21315

You can -- renv.lock is just JSON, so you can modify it as needed if you need to tweak a particular entry. (Or, you can use renv::record(<package>@<version>) to explicitly update the lockfile using renv APIs.)

If you're changing entries in renv.lock, you should normally remove the Hash component for modified entries. The hash is used for caching; it allows renv::restore() to restore a package from the global renv cache if available, thereby avoiding a retrieve + build + install of the package.

If it is not set, then renv will not use the cache and instead always try to retrieve the package from the declared source (which seems appropriate for your case).

Upvotes: 4

Related Questions