Saptarshi Guha
2015-Feb-27 00:20 UTC
[Rd] The Environment variables settings in bin/R, why do they ignore environment variables of the same name?
Hello, In installation/R/bin/R i notice 1. R_HOME_DIR is hard coded e.g. R_HOME_DIR=/usr/local/lib64/R 2. It ignores R_HOME_DIR echo "WARNING: ignoring environment value of R_HOME" 3. R_SHARE_DIR, R_INCLUDE_DIR and R_DOC_DIR are also hard coded. Is there a reason why these settings do not read the values from the environment variables of the same name (assuming they exist) and defaulting to these hard coded values in case they dont? Regards Saptarshi
Dirk Eddelbuettel
2015-Feb-27 02:05 UTC
[Rd] The Environment variables settings in bin/R, why do they ignore environment variables of the same name?
On 26 February 2015 at 16:20, Saptarshi Guha wrote: | In installation/R/bin/R i notice | | 1. R_HOME_DIR is hard coded e.g. | R_HOME_DIR=/usr/local/lib64/R | | 2. It ignores R_HOME_DIR | | echo "WARNING: ignoring environment value of R_HOME" | | 3. R_SHARE_DIR, R_INCLUDE_DIR and R_DOC_DIR are also hard coded. | | Is there a reason why these settings do not read the values from the | environment variables of the same name (assuming they exist) and | defaulting to these hard coded values in case they dont? AFAICR you supposed to deal with this via $PATH and just pick one: Ie with edd at max:~$ grep ^R_HOME_DIR /usr/lib/R/bin/R /usr/local/lib/R-devel/bin/R /usr/lib/R/bin/R:R_HOME_DIR=/usr/lib/R /usr/local/lib/R-devel/bin/R:R_HOME_DIR=/usr/local/lib/R-devel/lib/R edd at max:~$ I get, respectively, edd at max:~$ R --version | head -1 R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet" edd at max:~$ PATH="/usr/local/lib/R-devel/bin/:$PATH" R --version | head -1 R Under development (unstable) (2015-02-22 r67876) -- "Unsuffered Consequences" edd at max:~$ and I have R-devel aliased to RD and R-devel in /usr/local/bin. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
peter dalgaard
2015-Feb-27 08:05 UTC
[Rd] The Environment variables settings in bin/R, why do they ignore environment variables of the same name?
On 27 Feb 2015, at 01:20 , Saptarshi Guha <saptarshi.guha at gmail.com> wrote:> Hello, > > In installation/R/bin/R i notice > > 1. R_HOME_DIR is hard coded e.g. > R_HOME_DIR=/usr/local/lib64/R > > 2. It ignores R_HOME_DIR > > echo "WARNING: ignoring environment value of R_HOME" > > 3. R_SHARE_DIR, R_INCLUDE_DIR and R_DOC_DIR are also hard coded. > > Is there a reason why these settings do not read the values from the > environment variables of the same name (assuming they exist) and > defaulting to these hard coded values in case they dont?Yes. The R installation knows what the values should be and you do not. Especially if you have multiple version of R installed, you'd get yourself into a rotten mess otherwise. As I recall it, this logic was introduced years ago after instances of people building (say) r-devel from source and finding that it wouldn't run, the reason being that it was looking for system files in the wrong place (and as the relevant contents of the $R_HOME subdirectories only changed rarely, people had been getting away with it for a long time until we "suddenly broke r-devel"). -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com