r - 库不可写

标签 r ubuntu

我在 Ubuntu 机器上安装 R 版本 3.0.2 (2013-09-25) 时遇到这个问题:

install.packages("randomForest")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning in install.packages :
  'lib = "/usr/local/lib/R/site-library"' is not writable

如何解决?

最佳答案

对于 R 版本 3.2.2 (2015-08-14),应该解决这个问题,因为 R 在安装过程中建议使用不同的路径来存储 R 库。安装看起来像这样: (这里以'random'作为示例包)

install.packages('random')

Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning in install.packages("random") :
'lib = "/usr/local/lib/R/site-library"' is not writable

Would you like to use a personal library instead?  (y/n) y

Would you like to create a personal library
~/R/pc-linux-gnu-library/3.2
to install packages into?  (y/n) y

因此在安装过程中用“y”回答这两个问题应该会正确安装包。

19 年 1 月 18 日更新

如果您不想将 R 包存储在其他文件中:

作为Antoine-SacRobert TheSim指出您可以将自己添加到员工组,以便能够写入“站点库”。 (点击名字可以看到他们的重要补充)

在此更新之前,我在此评论中提到了使用“chmod o+w”更改文件夹“site-library”的权限的选项,以便能够对其进行写入。假设存在安全问题但在我警告过它时无法确定,但主要是在等待有人解决这个问题。 Antoine-Sac 和 Robert TheSim have done so同时。谢谢!

关于r - 库不可写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32540919/

相关文章:

r - ggplot2 三角函数图看起来呈锯齿状

opencv - 使用 Makefile 编译时对 opencv 函数的 undefined reference

linux - 启动 Vagrant 时连接超时

git - 了解 Gitosis 用户存储库访问

r - 使用 R 中的 Chartseries 截断 Y 轴

r - 如何对 `` dplyr `` or ` `tidyr`` 中的多列进行 rowSums?

r - R中的乘法常数

r - 如何在 knitr 中安装软件包?

android - 如何更改 eclipse 的默认背景高亮颜色?附上图片

c++ - 未找到 NTL 头文件