Displaying 1 result from an estimated 1 matches for "suppresswarnings2".
Did you mean:
suppresswarnings
2012 Oct 21
1
suppress *specific* warnings?
...arnings and
otherwise would produce the warnings as usual, but I don't quite know
enough about what I'm doing: see ??? in expression below.
Can anyone help, or suggest pointers to relevant
examples/documentation (I've looked at demo(error.catching), which isn't
helping me ... ?)
suppressWarnings2 <- function(expr,regex=NULL) {
opts <- options(warn = -1)
on.exit(options(opts))
withCallingHandlers(expr, warning = function(w) {
## browser()
if (is.null(regex) || grepl(w[["message"]],regex)) {
invokeRestart("muffleWarning")...