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

Michael M. Meyer mikem at salter-point.com
Thu Jan 18 16:03:50 CET 2001

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 read, 
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
command line option, to restore the default behaviour.

Maybe this is getting too complicated, and I'll just write my little 
wrapper function,

if ([ -f .Roptions ]) then
  exec R `cat .Roptions` $*
elif ([ -f $HOME/.Roptions ]) then
  exec R `cat $HOME/.Roptions` $*
  exec R $*

Mike Meyer, Salter Point Associates, Seattle WA

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