turning off specific types of warnings
jim holtman wrote:
?suppressWarnings
Note that this removes __all__ warnings, if you only want to remove
specific warnings, you can adapt suppressWarnings like this:
> h <- function(w) if( any(grepl("ouch", w)))
invokeRestart("muffleWarning")
> withCallingHandlers( warning("ouch"), warning = h )
> withCallingHandlers( warning("something else"), warning = h )
Warning message:
In withCallingHandlers(warning("something else"), warning = h) :
something else
Maybe it would make sense to extend suppressWarnings in this direction
Romain
On Wed, May 20, 2009 at 8:10 AM, Eleni Rapsomaniki <er339 at medschl.cam.ac.uk>wrote:
Dear R users,
I have a long function that among other things uses the "survest" function
from the Design package. This function generates the warning:
In survest.cph (...)
S.E. and confidence intervals are approximate except at predictor means.
Use cph(...,x=T,y=T) (and don't use linear.predictors=) for better
estimates.
I would like to turn this specific warning off, as it makes it difficult to
detect other (potentially more crucial) warnings generated by other parts of
my code.
Is there a way to do this?
Eleni Rapsomaniki
Research Associate
Strangeways Research Laboratory
Department of Public Health and Primary Care
University of Cambridge
Romain Francois Independent R Consultant +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr