R不接用户库 [英] R not picking up user library

查看:113
本文介绍了R不接用户库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有R 3.6.0的Fedora 30系统,并且用户库在Renviron中设置为此:

I have a Fedora 30 system with R 3.6.0 and the user library is set in Renviron as this one:

R_LIBS_USER=${R_LIBS_USER-'~/R/x86_64-redhat-linux-gnu-library/3.6'}

实际上,它显示在交互式R会话中:

And indeed it shows up in an interactive R session:

> Sys.getenv('R_LIBS_USER')
[1] "~/R/x86_64-redhat-linux-gnu-library/3.6"

> .libPaths()
[1] "/home/mu/R/x86_64-redhat-linux-gnu-library/3.6"
[2] "/usr/lib64/R/library"                          
[3] "/usr/share/R/library"     

> .Library
[1] "/usr/lib64/R/library"

> .Library.site
[1] "/usr/lib64/R/library" "/usr/share/R/library"

但是我还有一个Debian 10系统,在/etc/Renviron中我几乎完全相同:

But then I also have a Debian 10 system where in the /etc/Renviron I have pretty much exactly the same line:

R_LIBS_USER=${R_LIBS_USER-'~/R/x86_64-pc-linux-gnu-library/3.5'}

但是,尽管存在环境变量,但它没有显示在我的图书馆搜索路径中:

But it does not show up on my library search path, though the environment variable is there:

> Sys.getenv('R_LIBS_USER')
[1] "~/R/x86_64-pc-linux-gnu-library/3.5"

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

> .Library
[1] "/usr/lib/R/library"

> .Library.site
[1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library"      
[3] "/usr/lib/R/library"

当我安装软件包时,它也建议安装到该库中,但随后找不到它们并崩溃,请参见

When I install packages it also suggests to install into that library, but then it does not find them and crashes, see this other question. What is missing for this directory to also make it into the library path?

推荐答案

如果您有~/.Renviron,它可能会覆盖内容.而且,如果您有一个~/.Rprofile可以使用不存在的目录对.libPaths进行调用,那么您的搜索路径中都不会包含它们.

If you have a ~/.Renviron, it might overwrite things. And if you have a ~/.Rprofile which does a call to .libPaths with a non-existant directory you will have neither of them in your search path.

这篇关于R不接用户库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆