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

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

实际上,它显示在交互式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中,我几乎完全相同:
R_LIBS_USER=${R_LIBS_USER-'~/R/x86_64-pc-linux-gnu-library/3.5'}

尽管环境变量存在,但它没有显示在我的图书馆搜索路径中:
> 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"

当我安装软件包时,它还建议安装到该库中,但随后找不到它们并崩溃,请参阅this other question。该目录还缺少哪些内容以使其也进入库路径?

最佳答案

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

关于r - R不接用户库,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57656065/

10-11 02:37