[R] R environment variables

arnaud gaboury arnaud.gaboury at gmail.com
Sat Oct 10 12:24:07 CEST 2015


I was doing some cleaning ony my linux machine and, among others, I
try to clean my R environment variables accordingly [0] and [1].
I am not really sure how to declare in a clean manner these startup variables.

Here is my setup:

1- my home folder
-$ ls ~/.config/R
env/  helper/  Renviron  Rprofile.r

2- system R install
/usr/lib/R

3- user library
/developement/language/r/library

4- system configuration files: (NOTE: /usr/lib/R/etc/ are symlnks to
the below files)
$ ls /etc/R/
javaconf  ldpaths  Makeconf  Renviron  repositories

--------------------------------

Most important R environment variables for my system:
R_HOME, R_LIBS, R_LIBS_SITE,R_LIBS_USER,R_ENVIRON,R_ENVIRON_USER,R_PROFILE_USER

As far I can understand, in my setup, these above variables would be:
R_LIBS_SITE=/usr/lib/R/library
R_LIBS_USER=/developement/language/r/library
R_ENVIRON=/usr/lib/R/etc/Renviron
R_ENVIRON_USER=~/.config/R/Renviron
R_PROFILE_USER=~/.config/R/Rprofile.r

I have a doubt about two variables:
R_HOME=/usr/lib/R/ right ? Is there any need to export it in my environment?
R_LIBS=${R_LIBS_USER}:${R_LIBS_SITE} right ?

Do I need to export all these mentioned variables in my user
environment? Until now, I jsut export R_ENVIRON_USER,R_PROFILE_USER
via my /etc/profile file.

$ cat ~/.config/r/Renviron
....
R_HOME=/usr/lib/R
R_HOME_USER=/developement/language/r
R_LIBS_USER=${R_HOME_USER}/library
R_LIBS=${R_LIBS_USER}:${R_HOME}/library
R_HISTFILE=/developement/language/r/R.Rhistory
R_HELPER=/home/gabx/.config/r/helper
R_HISTSIZE=5000
............

Are the above variables correctly set ?

On a R session, Sys.getenv() returns correctly everything, except
R_LIBS_SITE which is empty. Why? Do I need to export it somewhere ?
R_LIBS        /developement/language/r/library:/usr/lib/R/library  Is
this the correct way for R to see R_LIBS? Then, when I upgrade
packages, do I need to upgrade separatly site library and user
library, or just one ligne upgardaing jusr R_LIBS?

Thank you for any advice on my current variable declaration setup.



[0]http://stat.ethz.ch/R-manual/R-devel/library/base/html/EnvVar.html
[1]http://stat.ethz.ch/R-manual/R-devel/library/base/html/Startup.html
-- 

google.com/+arnaudgabourygabx



More information about the R-help mailing list