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

2018-09-26  本文已影响0人  虚空纳鲁史爱民

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

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

重新设置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"  #只保留公共库
上一篇下一篇

猜你喜欢

热点阅读