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

Prof Brian D Ripley ripley at stats.ox.ac.uk
Thu Jan 18 08:42:28 CET 2001


On Wed, 17 Jan 2001, Michael M. Meyer wrote:

> (On Unix/Linux)
> Is it possible to set the  --no-save  command line option as an option
> in the .Rprofile file.   I have looked in the sources and do not see
> any obvious (user initiated) ways of changing the command line defaults,
> but I am hoping I have missed something.
>
> I *know* I can write my own shell script wrapper that calls R with
> whatever arguments I want (and I do that).  However there are times
> when I would like to have per-directory control of R, just as the
> Rprofile file does it.
>
> (And yes, it would be trivial to write an R wrapper that looked for a
> file in the local directory that contained command line arguments,
> I just don't want to invent that wheel unless there is nothing simpler).

Interesting: no, you can't set this as it gets used at a very early stage:
in batch use it is checked before launching R.  However, it is
only actually used in two cases (as far as I remember):

(i)  As the default arg for q()
(ii) With an implicit q() at the end of file in batch use.

For the first, you can re-define q() in the .Rprofile, as

q <- function (save = "no", status = 0, runLast = TRUE)
.Internal(quit(save, status, runLast))

For the second you can do nothing, but you will have had to specify the
option in the command line, anyway.  (Certain error actions such as
user signals also quit, but they all specify save/nosave.)

Is this enough?  We could provide an options argument to set the default in
q(), or just make it a settable R variable, say .quit.default, if there was
a need not met by the above.


I assume you are not using the GNOME GUI.  That has the annoying (and as
far as I know undocumented) side-effect of saving the --save/--no-save/ask
setting in its configuration file and using it next time around.  Only,
there is no way to specify "ask" on the command line, so the only
way to get back to it is to edit the configuration file.


-- 
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