no permission to install to directory
1
0
Entering edit mode
8 months ago
sooni ▴ 20

Hello. I am a graduate student, and I am trying to analyze using R server through the infrastructure server provided by my school.

When I try to install an R package, an error occurs: ‘Error: ERROR: no permission to install to directory ‘/usr/lib/R/library’’. Does anyone know why this error occurs?

One more thing: R is also installed on the laptop I use.

Thank you for your help!

R • 689 views
ADD COMMENT
0
Entering edit mode

sooni : You asked many questions over the last few months but seem to have never validated any answers (upvote or accept using green check mark). See here

Please consider doing so. Validating answers makes them useful for future visitors and is the appropriate means of appreciating (free) help you get on biostars.

ADD REPLY
4
Entering edit mode
8 months ago
LChart 4.6k

currently your R is using the global binary (probably in /usr/bin/R), which will attempt by default to install libraries into /usr/lib/R/library. These directories are generally not modifiable except under very rare circumstances.

The .libPaths function (https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/libPaths) allows you to change where R looks for and installs packages, e.g., if you set

dir.create("/home/sooni/Rlib")
.libPaths("/home/sooni/Rlib")

will use the local Rlib directory (that you just made) to build and install packages. More generally from the documentation:

The library search path is initialized at startup from the environment variable R_LIBS

so using

export R_LIBS=/home/sooni/Rlib

before running R will instruct R to use your local directory (note that /home/sooni/Rlib must actually exist for this to work).

ADD COMMENT

Login before adding your answer.

Traffic: 2398 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6