[Rd] The Environment variables settings in bin/R, why do they ignore environment variables of the same name?

peter dalgaard pdalgd at gmail.com
Fri Feb 27 09:05:39 CET 2015

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

More information about the R-devel mailing list