How is automatic snapshot of local changes in packrat supposed to work?

rstudio
packrat

#1

I've been using packrat fairly regularly for a while in projects, and I noticed as soon as I started using it there is a button in the interface which "automatically snapshot local changes".

I've never turned it off, I believe it is on by default, but I've never noticed it actually snapshotting my work. I start a project, add some packages through install.packages(), carry on with my work using those packages, and find when a colleague goes to pull my work that the packrat folder isn't up to date, I go back to my work, and find that I need to manually run packrat::snapshot() to update the packrat libraries, commit the changes then push.

What specifically does the "automatic snapshot" feature do? If I've interpreted it correctly, is there a specific set of heuristics that it uses that for some reason I might not be conforming to?


#2

This is a deprecated feature of RStudio / Packrat. The intention was that Packrat and RStudio would attempt to monitor your library paths, and if it detected that you had recently installed a new R package, we would automatically 'snapshot' the change (thereby adding the newly installed package to the Packrat lockfile).

Unfortunately, this lead to a lot of problems + confusion in practice, and so we now disable this by default and newer versions of the RStudio IDE will be disabling some of this extra Packrat integration.