[R] Can one set --no-save in .Rprofile

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Jan 18 17:13:05 CET 2001

> Date: Thu, 18 Jan 2001 07:03:50 -0800
> From: "Michael M. Meyer" <mikem at salter-point.com>
> Thanks to Brian Ripley and Robert Gentleman
> who both suggested  adding
> rgentlem at jimmy.harvard.edu said:
> >    q<-function (save = "no", status = 0, runLast = TRUE)
> >  .Internal(quit(save, status, runLast)) 
> to the .Rprofile.
> While this works (and I might use it), it is not as clean as I would 
> like.  For instance, with this profile, if I subsequently run
> 	R --save
> the "--save" will be ignored.
> It would seem a good solution might be to allow something in the 
> environement (or .Renvironment file) like
> 	R_OPTIONS = "--nosave --noreadline ..."
> One could then (logically) parse those options  before the command line is 
> and have the command line override anything set in the R_OPTIONS 
> string.  The one wrinkle is the --no-init-file option.  So I guess the 
> logic has to go something like.
> 1) Read command line args (and save them somewhere).
> 2) if(exists(.Rprofile) and we should read it)  parse that file.
> 3) re-parse command line options to override the init file.
> If one were to go this route, then one probably needs a
> 	--save-ask
> command line option, to restore the default behaviour.
> Maybe this is getting too complicated, and I'll just write my little 
> wrapper function,

Yes, it is, and one needs a precedence anyway.  Remember that R
comes with half a dozen front-ends and three major groups of OSes.

The logic is 

1) The front-ends set some internal variables, usually via flags, and set
some environment variables via parsing .Renviron.

2) Then the R parser is started, and reads .Rprofile.  On most
platform that reads some environment variables to set defaults.

3) Eventually a prompt appears

with lots of things in the gaps.  It is not at all easy to go backwards
in the sequence.  After all, one platform (Mac) does not even have
environment variables.


Brian D. Ripley,                  ripley at 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-help 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-help-request at stat.math.ethz.ch

More information about the R-help mailing list