R - How to set the path for install.packages () for a brilliant server? - ubuntu

For my system: Ubuntu 12.04 and R 3.03 when I install a custom package in R via

>install.packages() 

the package is installed by default on

 /home/USER/R/x86_64-pc-linus-gnu-library/3.0/ 

unlike system-wide in

 /usr/local/lib/R/site-library/ 

which is necessary for a brilliant server to work with this package.

My temporary solution is to copy packages to the correct folder after the fact.

Question: How can I set the default installation path from the very beginning to avoid this problem?

+4
source share
2 answers

Yes. I consider it unreliable and disable my folder for each user.

In addition, I mainly use script install.r (of which the version is an example in the littler package, which you can install as part of Ubuntu), which simply explicitly sets the /usr/local/lib/R/site-library directory as the value for by default. With the patch we received in R 3.0.2 or 3.0.3, an ordinary user can write to a directory and now create directories written to groups so that other users can update and overwrite - just make everyone members of the same group, say staff or admin . And then you don't even need sudo or root.

I essentially answered the same question several times here over the years (minus the brilliant angle, which is not very relevant), so do not hesitate to look for another for more detailed information, examples, ...

+3
source

I would suggest a different approach.

The problem is that the brilliant server cannot find the packages that you are installing, because it runs them as another user called shiny . This user is created when a brilliant server is installed.

The easiest (and safest IMHO) way to solve this is to simply install the packages as a brilliant user by following these steps.

  • Set the password for the user using sudo passwd shiny , enter and confirm the password of your choice.
  • Switch to a brilliant account using: su - shiny
  • Call R with $ R (without sudo)
  • Install the necessary packages, in this case: `install.packages (" shinydashboard ")

Please note that if you have rstudio-server installed on one computer, you can perform steps 2-4 using this interface. Just go to the same / ip domain and use: 8787 for the rstudio-server interface instead of: 3838 for a brilliant server.

Adapted from my answer here

0
source

Source: https://habr.com/ru/post/969691/


All Articles