On 25/07/2012 09:14, peter dalgaard wrote:
On Jul 25, 2012, at 07:58 , Prof Brian Ripley wrote:
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 in 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.
Notice also that R_HOME represents R's own knowledge of its installation
directory, where it looks for various support files, the default package
library, etc.
R sets R_HOME for itself; even if you could, you really do not want
to override it. Try looking at ?Startup for the correct ways to specify
alternative locations of profile files, etc.
Well, I was being careful, and the following may be too technical for
R-help.
R's own front-ends set R_HOME for themselves, but embedded versions of R
may well get it from somewhere else and for such uses the end-user may
need to specify it as an environment variable in the process embedding
R. Alternative front-ends (e.g. RStudio) are examples of embedding and
do need a way to find R's own installation directory (which may or may
not be recorded in the Windows Registry on Windows). Rgui.exe uses its
own path to find R_HOME.
--
Brian D. Ripley, rip...@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
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.