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 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.
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. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd....@cbs.dk Priv: pda...@gmail.com ______________________________________________ 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.