关于在Rstudio-server中直接在公用库中安装和使用R包

在Rstudio中输入 .libPaths() 查看R调用的库

> .libPaths() [1] "/cluster/home/jlu/R/x86_64-unknown-linux-gnu-library/3.5.1" "/usr/local/lib64/R/library"

【关于在Rstudio-server中直接在公用库中安装和使用R包】重新设置R的默认库
> .libPaths(c("/cluster/apps/R/3.5.1/lib64/R/library", .libPaths())) # R包会默认安装到第一个路径下> .libPaths() [1] "/cluster/apps/R/3.5.1/lib64/R/library" "/cluster/home/jlu/R/x86_64-unknown-linux-gnu-library/3.5.1" [3] "/usr/local/lib64/R/library"

或者直接替换
> .libPaths("/cluster/apps/R/3.5.1/lib64/R/library") > .libPaths() [1] "/cluster/apps/R/3.5.1/lib64/R/library"#只保留公共库

    推荐阅读