Set packrat::on() as project default

packrat

#1

Is there a way to always have packrat set to packrat::on() as a project default?

I just spent a couple hours trying to figure why my code had stopped working only to realise that the project had switched back to my system/user package library when I'd restarted the R session at one point.

cheers!


#2

Normally, a project using Packrat will always launch using the private library associated with that project. Packrat generates a .Rprofile file which sets these library paths on startup, and the regular R startup routine sources that file.

Any chance you can share the steps that got you into this state, so we can know why the library paths reverted away from the defaults?


#3

Hi Kevin. I seems that the default path on all my packrat projects is the system/user library. I have to manually turn packrat on every time and whenever I restart the R session it switches back to the system lib.

Should the .Rprofile be in the packrat folder? I can't see it in there.


#4

It should be in the root of your project folder. Packrat generates it for you on the first call to packrat::init().