Trouble with packrat corrupting R functioning

Through further trial and error given the prods of @BondedDust I finally appear to have solved the issue. Having previously tried to use packrat in the particular working directory in which I was working appears to have left some vestiges despite later uninstalling packrat.

In particular, packrat edits your local .Rprofile (original credit due to @zerweck and @snaut), which is source()d on R startup in that directory.

If you use the .Rprofile to store some local configurations, you should edit the file and remove the packrat lines (or any you don't recognize); otherwise, you should just delete that file to restore your project to working as expected.


Check your HOME directory for an unintentional .Rprofile.

Packrat may have put this here if you tried to packrat::init() in HOME.

install.package() with packrat looks for .Rprofile when run. The behavior I've observed has it prioritizing the HOME .Rprofile over the getwd() one, causing the

cannot open file 'packrat/init.R': No such file or directory