问题
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:
The issue was indeed that .Rprofile wanted to initialize packrat() on starting R. To fix this, use the below.
Removing Packrat from .Rprofile
- Open Terminal
- Type on a new command line: open ~/.Rprofile
- Delete the lines related to packrat (these should be clearly labelled because they contain the word packrat)
- Save the file
- Restart R/Rstudio
来源:https://stackoverflow.com/questions/37485542/r-packrat-will-not-completely-uninstall