s-news
[Top] [All Lists]

FW: Confusion with options(error=NULL)

To: "'s-news@lists.biostat.wustl.edu'" <s-news@lists.biostat.wustl.edu>
Subject: FW: Confusion with options(error=NULL)
From: "Biggerstaff, Brad J." <bkb5@cdc.gov>
Date: Thu, 22 Mar 2001 11:51:46 -0500
Apologies: S-Plus 2000, R 1 (have tried to get the network guy to update to
2 many times!), on Windows NT.


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


>  -----Original Message-----
> From:         Biggerstaff, Brad J.  
> Sent: Thursday, March 22, 2001 9:20 AM
> To:   's-news@lists.biostat.wustl.edu'
> Cc:   Biggerstaff, Brad J.
> Subject:      Confusion with options(error=NULL)
> 
> 
> 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
> 
> 

<Prev in Thread] Current Thread [Next in Thread>