In the following code fragment
...
default.opts <- options()
on.exit(options(default.opts))
options(error=NULL)
# use Venables & Ripley's try() which returns NULL
rather than the error message
result <-
vr.try(do.call("uniroot",c(list(f=eval(as.name
(compute.function)),lower=lower,upper=upper),uni.args))$root)
}
structure(list(compute.this=compute.this,result=result,
call=match.call()),class="icc.sample.size")
}
I am trying to supress the printing of the error message resulting from the
call to uniroot when the endpoints of the search interval have the same sign
(or any other error message, actually). I then will print out my own
message within a print method by looking for a NULL value in result. The
trouble is that the error message is still printed, though I thought
options(error=NULL) should take care of this: from the help page, "The
option error=NULL eliminates all error actions."
Any suggestions?
FYI: the try() version used here can be found on p. 48 of V&R's _S
Programming_. I'd rather have NULL than the S-Plus-generated error message
in this case.
Brad Biggerstaff, Ph.D.
Mathematical Statistician
Division of Vector-Borne Infectious Diseases
CDC/National Center for Infectious Diseases
PO Box 2087 Fort Collins, CO 80522-2087
970.221.6473 +++ bbiggerstaff@cdc.gov
|