R: Packrat 不会完全卸载

R: Packrat will not completely uninstall

我之前在 RStudio 中打开了 packrat()。我现在希望完全删除并禁用它(即恢复到安装 packrat 之前的状态)。我试图在 Rstudio 中找到一个选项来禁用它,但什么也找不到。因此,我通过(在 OSX 10.9.5 上)将 R 和 RStudio 的图标从应用程序文件夹拖到垃圾桶来卸载 R 和 RStudio。然而,在重新安装 R(版本 3.2.3)后,R 控制台显示以下消息并弹出窗口提示我 select CRAN 镜像:

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 ---

因此,我在库中找到了一个名为 'packrat.' 的文件夹,将其删除后,我现在在启动 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

这与在 中发现的错误相同,但是当我在 Finder 中搜索时没有找到 .Rprofile 或 .Rhistory 文件,我不知道在哪个工作目录中手动搜索。有人可以建议如何实施上面链接的解决方案吗?

问题确实是 .Rprofile 想要在启动 R 时初始化 packrat()。要解决此问题,请使用以下方法。

正在从 .Rprofile 中删除 Packrat

  1. 打开终端
  2. 在新的命令行中键入:open ~/.Rprofile
  3. 删除与 packrat 相关的行(这些应该清楚地标记,因为它们包含单词 packrat)
  4. 保存文件
  5. 重启R/Rstudio