R: Packrat will not completely uninstall

白昼怎懂夜的黑 提交于 2019-12-13 14:19:59

问题


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

  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


来源:https://stackoverflow.com/questions/37485542/r-packrat-will-not-completely-uninstall

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!