rrenv

Updating renv lock file after installing a package


I just did renv::install("lme4") followed by renv::snapshot(). The package installed successfully, and the lockfile is updated:

Lockfile written to '.../renv.lock'

but there is no "lme" keyword in this lockfile. Shouldn't the lockfile have updated after I retook the snapshot?


Solution

  • lme4 wont be snapshot into your lockfile unless it is identified as being used/required by your project. you could have many packages installed in your system that your project doesnt use, and we wouldnt want the lockfile to be bloated/not indicitive of what your project needs to run. simply having one of your code files load lme4 with library() or require() would be an easy way to let renv find lme4 is a dependency you have.