RStudio更新到R 3.4后看不到软件包 [英] RStudio does not see packages after update to R 3.4
问题描述
我有Ubuntu 16.04,将R更新到3.4.1版本后,即使它们也已更新,它也看不到我的软件包:
I have Ubuntu 16.04 and after update of R to 3.4.1 version it does not see my packages even though they have also been updated:
> library(dplyr)
Error in library(dplyr) : there is no package called ‘dplyr’
包在那里:
$ ls ~/R/x86_64-pc-linux-gnu-library/3.4/ | grep plyr
dplyr
plyr
我的.libPaths
:
> .libPaths()
[1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library" "/usr/lib/R/library"
将.libPaths
设置为所需路径仅适用于一个会话.我希望它是永久的.
Setting .libPaths
to desired path does the thing just for one session. I'd like it to be permanent.
我还尝试将变量R_LIBS
,R_LIBS_SITE
和R_LIBS_USER
设置为所需的路径,如
I also tried to set the variables R_LIBS
, R_LIBS_SITE
and R_LIBS_USER
to desired path as indicated here but it worked only in the console (didn't work in RStudio).
推荐答案
找到了解决方案:
在文件/usr/lib/R/etc/Renviron
中,存在R的配置.
Found the solution:
In the file /usr/lib/R/etc/Renviron
there is a configuration of R.
第43-45行有:
# edd Jun 2017 Comment-out R_LIBS_USER
#R_LIBS_USER=${R_LIBS_USER-'~/R/x86_64-pc-linux-gnu-library/3.4'}
##R_LIBS_USER=${R_LIBS_USER-'~/Library/R/3.4/library'}
我没有评论R_LIBS_USER=${R_LIBS_USER-'~/R/x86_64-pc-linux-gnu-library/3.4'}
,重新启动了RStudio,现在可以使用了.
I have uncommented R_LIBS_USER=${R_LIBS_USER-'~/R/x86_64-pc-linux-gnu-library/3.4'}
, restarted RStudio and now it works.
编辑:查看评论,似乎是有计划的行为. 这里是另一种解决方案.
Looking at the comments, it seems like a planned behaviour. Here is another solution.
这篇关于RStudio更新到R 3.4后看不到软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!