R-alpha: options() and .Options -- ?

Martin Maechler (maechler@stat.math.ethz.ch)
Tue, 10 Dec 96 11:59:57 +0100


Date: Tue, 10 Dec 96 11:59:57 +0100
Message-Id: <9612101059.AA13058@>
From: Martin Maechler <maechler@stat.math.ethz.ch>
To: R-testers mailing list <R-testers@stat.math.ethz.ch>
Subject: R-alpha: options() and .Options -- ?

This is not a bug report, rather than some remarks as a "request for comments":

It is clear that  options( foo = bar )
sets the option and also updates the builtin()  .Options  list :

	> options(myopt = pi)
	> .Options$my
	[1] 3.14159265

In S-plus, it was (is) possible to use .Options locally in a function frame
in order to just affect some options during evaluation of that function.

In R, this does not work,
but this may be completely okay,

and one should encourage people to use

	old.o <- option(foo = bar);  on.exit(options(old.o))

instead of 

	.Options $ foo <- bar

It only gets slightly more cumbersome if you have (at a different place in
your function) a second statement

	.Options $ myopt <- this

you now must use

	old.o <- c(old.o, option(myopt = this))

which is "asymmetric" and 
the 2 'options' statements are no longer 'exchangeable'...

-------
Martin
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- For info or help, send "info" or "help",
To [un]subscribe, send "[un]subscribe"
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-