设置R_LIBS&避免“你想使用个人图书馆吗?”

时间:2015-04-30 14:01:15

标签: r

我的个人库在〜/ .Renviron中设置为R_LIBS =〜/ .R / lib。当我从rstudio安装软件包时,这非常有效。当我尝试从普通的R控制台会话安装新软件包时,它总是问我:

Would you like to use a personal library instead?  (y/n) y
Would you like to create a personal library
~/R/x86_64-redhat-linux-gnu-library/3.1
to install packages into?  (y/n) n

当我从控制台会话进行更新时,〜/ .R / lib(以前从rstudio安装)中的现有软件包更新没问题。如果/ usr中还有全局包也需要更新,R再次询问我是否要创建〜/ R / x86_64-redhat-linux-gnu-library / 3.1。

我尝试了很多配置,并没有找到解决方法。

亲提示?

1 个答案:

答案 0 :(得分:3)

是的,我总是在我使用的系统上取消它,我甚至试图将它保留在我维护的Debian软件包之外。在Debian中我们使用

/usr/lib/R/library                   for core R packages shipping with R
/usr/lib/R/site-library              for r-cran-* packages from the distro
/usr/local/lib/R/site-library        for what the user installs from CRAN

以适当的顺序:

R> .libPaths()
[1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library"   \
    "/usr/lib/R/library"           
R> 

我通过评论来做到这一点

#R_LIBS_USER=${R_LIBS_USER-'~/R/x86_64-pc-linux-gnu-library/3.1'}
#R_LIBS_USER=${R_LIBS_USER-'~/Library/R/3.1/library'}

# edd Apr 2003  Allow local install in /usr/local, also add a directory for
#               Debian packaged CRAN packages, and finally the default dir 
# edd Jul 2007  Now use R_LIBS_SITE, not R_LIBS
R_LIBS_SITE=${R_LIBS_SITE-'/usr/local/lib/R/site-library:\
                           /usr/lib/R/site-library:/usr/lib/R/library'}

我认为我必须在Debian包装中更新我的补丁......