1

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?

user1700890
  • 7,144
  • 18
  • 87
  • 183

1 Answers1

1

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).

Kevin Ushey
  • 20,530
  • 5
  • 56
  • 88