简体   繁体   中英

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.

(I need the packages in the system library so that Shiny Server can find them)

How do I make R install into the system library instead of a user specific one?

Old question, but something I ran into. I found this on Dean Attali's guide to setting up a shiny server:

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. Seems to work well for me so far.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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