R's startup : .Rprofile & .Renviron -- info and RFC

Prof Brian D Ripley ripley@stats.ox.ac.uk
Fri, 24 Sep 1999 11:07:40 +0100 (BST)

On Fri, 24 Sep 1999, Martin Maechler wrote:

> 		[RFC = Request for Comments]
> { Yes, the documentation for .Renviron is really not there (but the FAQ...);
>   the rest is in ?Startup }
> In R's Startup (on Unix only??) {unless --no-environ is specified}
>  ~/.Renviron (if there) is read as an 'sh' script before R is called,

On Windows it is read as a set of NAME=VALUE statements.

> then R looks ((for the site-wide Rprofile and then))
> for .Rprofile in the current directory and then for ~/.Rprofile
> (in the user's home directory).
> I'd like to set R_NSIZE and R_VSIZE ``project dependent'' automatically,
> and therefore would like  .Renviron also searched in the currenct directory
> before the $HOME directory.
> (setting --nsize or --vsize explicitly would always override as they
> should).
> Is this desired?  
> Is is portable (at least) to Windows?

Yes, no problem. 

> In the windows FAQ I've learnt that you must set the command line
> arguments --nsize ..  when defining a shortcut to the R executable
> in the corresponding directory (correct?).
> Is this *the* windows way or does is make sense to have .Renviron files
> ($HOME would only be used on NT, I presume ?

Sorry, I don't see that as the only way in the rw-FAQ, but I do see how to
use .Renviron under Q2.2.

The current position is:

R figures out a value for R_USER.
It (effectively) reads its environment
It then reads R_USER/.Renviron as NAME=VALUE pairs
It then reads NAME=VALUE pairs off the command line.
It then processes --nsize etc.

The algorithm for R_USER is

If set, use it.
Else if HOME is set, use that (it normally is not).
Else if HOMEDRIVE and HOMEPATH are set (they usually are on NT) use
 HOMEDRIVE\HOMEPATH (the docs have this wrong, I see).
Else use the startup directory.

All we would need is to look for ./.Renviron then R_USER/.Renviron.

Brian D. Ripley,                  ripley@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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch