Skip to content

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

3 messages · Martin Maechler, Brian Ripley

#
[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,

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?
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 ?
	-- yes, I am a complete ``Wingnorant'' !)

Martin Maechler <maechler@stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO D10	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Fri, 24 Sep 1999, Martin Maechler wrote:

            
On Windows it is read as a set of NAME=VALUE statements.
Yes, no problem.
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.
#
On Fri, 24 Sep 1999, Martin Maechler wrote:

            
It seems done on Unix, so now on Windows too, if not committed yet.

You had been worried, but all the info is in the Windows README. However,
I had got HOMEDRIVE as HOMEDIR, so thank you getting me to re-read it!

Brian