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

About this list Date view Thread view Subject view Author view Other groups

Subject: Re: R's startup : .Rprofile & .Renviron -- info and RFC
From: Prof Brian D Ripley (
Date: Fri 24 Sep 1999 - 20:07:40 EST

Message-ID: <Pine.GSO.4.05.9909241053250.13755-100000@auk.stats>

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,        
Professor of Applied Statistics,
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 Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b25 : Tue 04 Jan 2000 - 14:16:08 EST