我想弄清楚为什么我的.libPath命令行R和RStudio 桌面之间有所不同(注意:这不是这个问题的重复,因为该修复涉及特定于RStudio Server的东西,我没有).
当我在命令行(linux)上使用R时:
> .libPaths()
[1] "/home/mathematicalcoffee/R/library" "/usr/local/lib/R/site-library"
[3] "/usr/lib/R/site-library" "/usr/lib/R/library"
Run Code Online (Sandbox Code Playgroud)
当我使用RStudio Desktop(linux,同一台机器)时:
[1] "/usr/local/lib/R/site-library" "/usr/lib/R/site-library" "/usr/lib/R/library" "/usr/lib/rstudio/R/library"
Run Code Online (Sandbox Code Playgroud)
现在我已$R_LIBS_USER到~/R/library我的bash的个人资料,所以R-命令行捡起来,为我的首选LIBPATH.
当我这样做时,问题出在RStudio桌面:
Sys.getenv('R_LIBS_USER')
# "~/R/x86_64-pc-linux-gnu-library/2.15"
Run Code Online (Sandbox Code Playgroud)
那么为什么RStudio桌面会改变我的R_LIBS_USER?我怎样才能改回来?(我不使用.Rprofile文件).(在我上面链接的问题中,RStudio Server的解决方案是修改/etc/rstudio/rsession.conf,但我没有,因为我有RStudio桌面.而且,我相信RStudio应该尊重我的R_LIBS_USER环境变量.)