Skip to content
Prev 180939 / 398506 Next

turning off specific types of warnings

jim holtman wrote:
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