R-alpha: .Options$digits do not (always) work.

Martin Maechler Martin Maechler <maechler@stat.math.ethz.ch>
Mon, 4 Aug 1997 18:15:49 +0200


I am sorry that this IS an old topic.
Yet another task
I think the bug is somewhere in hidden  in  src/main/options.c ..

##-- The following does not work as it should in  R (0.50-a1, but I think
							also earlier)

tst <- function(x=pi, dig =3) {.Options$digits <- as.integer(dig); print(x);x}
tst()
tst(dig = 12)


##-- This should do the same; it works as expected in R & S :

tst2 <- function(x=pi, dig =3) {
  oo <- options(digits=dig); on.exit(oo); print(x);x}
tst2()
tst2(dig = 12)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-