[R] inconsistency in options "error" and "show.error.messages"?

Thomas J Vogels tov at ece.cmu.edu
Wed Aug 1 03:42:38 CEST 2001


Hello,

I'm slightly confused by the options "error" and "show.error.messages" and
how they are currently handled.  The following refers to R 1.3.0 (AIX:
2001-07-27 and Windows: 2001-06-22).

What I thought I could do to catch error messages and take over control over
their output is (along what I found on the try help page):

> sem<-getOption("show.error.messages") #store previous value
> options(show.error.messages=FALSE)    #don't show error messages
> msg<-try(log("a"))                    #do our calculation
> options(show.error.messages=sem)      #restore previous value of the
option
> unclass(msg)                          #peek at the error messages...
[1] "Error in log(x) : Non-numeric argument to mathematical function\n"

(Where I use log("a") and unclass(msg) to have some simple examples.)

Alas, afterwards all error messages continue to be suppressed, i.e. are not
shown.  This is simply because getOption("show.error.messages") is NULL
right at the start of my R session!

And this is where my confusion lies:

- Since error messages are always shown until I turn them off explicitly, I
would have expected getOption("show.error.messages") (and thus sem in the
code snippet above) to be TRUE after startup.

- On AIX/R patched I get the following options list:
> grep ("error", names(options()), value=TRUE)
[1] "error"
So there is no option "show.error.messages" set at all (and hence the NULL).

- On Windows/R release, I get the following options list:
> grep ("error", names(options()),value=TRUE)
[1] "error.messages"
What option is this?  It's neither "error" nor "show.error.messages" which
are the documented options.

Where did I go wrong?

Thanks,
  -tom

--
Email: vogels at cmu.edu


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