[R] R doesn't recognize R_HOME value

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jul 25 07:58:15 CEST 2012


On 24/07/2012 21:57, Kirk Fleming wrote:
> ???
>
> Windows 7 is where I'm seeing the problem.
>
> The root problem: while I have R_HOME legitimately specified within Windows
> 7, and issuing 'set R_HOME' from the command line returns exactly the path
> I've specified, doing a Sys.getenv('R_HOME') from R returns a completely
> different path.
>
> I ask, "What would cause a Sys.getenv() call to return a different value
> than the OS does?"

A different process and hence a different environment ... this is why 
they are called 'environment variables' and are specific to a process.

'The command line' is actually a shell process, not the OS itself. 
Setting environment variables in a shell affects only that shell and 
those which inherit from it.

See ?R_HOME in R, which tells you that is the R process 'is normally set 
on startup'.   'Normally' because there are many ways to start R 
(embedded, for example: see 'Writing R Extensions'), and you have not 
actually told us how you started R.  But Rgui.exe and Rterm.exe do 
always set R_HOME.


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list