4
votes

I previously turned on packrat() in RStudio. I now wish to completely remove and disable it (i.e. revert to the state prior to installing packrat). I tried to find an option in Rstudio to disable it but could find anything. I therefore uninstalled R and RStudio by (on OSX 10.9.5) dragging the icons for R and RStudio from the applications folder to the trash. However, upon reinstallation of R (version 3.2.3), the R console displayed the following message and a pop-up prompted me to select a CRAN mirror:

Packrat is not installed in the local library -- attempting to bootstrap an installation... No source tarball of packrat available locally --- Please select a CRAN mirror for use in this session ---

So, I found in Library a folder named 'packrat.' After deleting this, I now receive the following upon starting R:

Error in file(filename, "r", encoding = encoding) :

cannot open the connection

In addition: Warning message:

In file(filename, "r", encoding = encoding) : cannot open file 'packrat/init.R': No such file or directory

This is the same error as found in: Trouble with packrat corrupting R functioning yet no .Rprofile or .Rhistory files are found when I search in Finder and I do not know which working directory to search in manually. Can someone advise on how to implement the solution linked above?

1

1 Answers

4
votes

The issue was indeed that .Rprofile wanted to initialize packrat() on starting R. To fix this, use the below.

Removing Packrat from .Rprofile

  1. Open Terminal
  2. Type on a new command line: open ~/.Rprofile
  3. Delete the lines related to packrat (these should be clearly labelled because they contain the word packrat)
  4. Save the file
  5. Restart R/Rstudio