简体   繁体   English

如何将 R 包安装到 Linux 上的系统库中?

[英]How do I install R packages into system library on Linux?

Regardless of whether I run R or sudo R , when I then run install.packages("name") the packages always gets installed into /home/james/R/... as opposed to a system library.无论我是运行R还是sudo R ,当我运行install.packages("name")时,软件包总是安装到/home/james/R/...而不是系统库。

(I need the packages in the system library so that Shiny Server can find them) (我需要系统库中的包,以便 Shiny 服务器可以找到它们)

How do I make R install into the system library instead of a user specific one?如何让 R 安装到系统库而不是用户特定的库中?

Old question, but something I ran into.老问题,但我遇到了一些问题。 I found this on Dean Attali's guide to setting up a shiny server:我在Dean Attali 的设置 shiny 服务器的指南中找到了这个:

sudo su - -c "R -e \"install.packages('<PACKAGE>', repos='http://cran.rstudio.com/')\""

My understanding is that you're essentially installing the package globally as the root user so that any user can access it.我的理解是,您实际上是以 root 用户身份全局安装 package 以便任何用户都可以访问它。 Seems to work well for me so far.到目前为止,似乎对我来说效果很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM