1

This is a somewhat generalized version of this question. How do I set R_LIBS_SITE? I am not able to get proper values for it on both CentOS 7.2 and openSUSE 42.1 with the most recent R 3.3.1.

On CentOS 7.2 (Linux x86_64) with R from EPEL I get:

R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
...
Platform: x86_64-redhat-linux-gnu (64-bit)
...
> .libPaths()
[1] "/usr/lib64/R/library" "/usr/share/R/library"
> .Library
[1] "/usr/lib64/R/library"
> .Library.site
[1] "/usr/lib64/R/library" "/usr/share/R/library"
> R.home(component = "home")
[1] "/usr/lib64/R"

However, the respective Renviron includes the following:

$ grep R_LIBS_SITE /usr/lib64/R/etc/Renviron
R_LIBS_SITE=${R_LIBS_SITE-'/usr/local/lib/R/site-library:/usr/local/lib/R/library:/usr/lib64/R/library:/usr/share/R/library'}

Apparently, this setting is not applied properly when I start R. However, changes for example in R_LIBS_USER in the same file are applied. In addition, R_LIBS_SITE is not ignored completely because setting it to

R_LIBS_SITE='/usr/local/lib/R/site-library'

produces

> .Library.site
character(0)

I don't see where R_LIBS_SITE could be overwritten elsewhere. I get the same behaviour in R when I start it with

R --no-environ --no-site-file --no-init-file

I can reproduce a similar behaviour with openSUSE.

Or is there another recommended way to set a package site shared amongst all users?

sebschub
  • 213
  • 4
  • 20

1 Answers1

5

A possible explanation of the problem is that some of the directories do not exist. Directories that do not exist are silently removed from the list. So, if you set

R_LIBS_SITE='/usr/local/lib/R/site-library'

and the directory does not exist, .Library.site will be an empty string (like in your example). Following the outputs from your example, if directories /usr/local/lib/R/site-library and /usr/local/lib/R/library do not exist, they will be silently removed from the list given in R_LIBS_SITE of your Renviron file (again like in your output).

Tomas Kalibera
  • 1,061
  • 9
  • 13