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

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 Likes

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.

4 Likes

Hi there,

Sorry for the bump, but if this feature is deprecated, maybe this walkthrough should be edited. Currently it states :

If you have automatic snapshots turned on, Packrat will record package upgrades and additions in the background, so you don’t even need to remember to call ::snapshot() manually

1 Like

Interestingly, the actual check box still exists in RStudio project options as of Version 1.2.1114 on Mac.

TBF though it's not ticked by default it seems.