Displaying 1 result from an estimated 1 matches for "msg81380".
2010 Dec 05
1
How to catch both warnings and errors?
...ice string (as it is printed
in a normal warning/error message)? The approach shown below is somehow ugly.
Basically, I had trouble converting the call w$call to a string.
## based on http://tolstoy.newcastle.edu.au/R/help/04/06/0217.html
## and http://www.mail-archive.com/r-help at r-project.org/msg81380.html
f <- function(x){
## warnings
w.list <- NULL # init warning
w.handler <- function(w){ # warning handler
warn <- simpleWarning(w$message, w$call) # build warning
w.list <<- c(w.list, paste(warn, collapse = " ")) # save warning
invokeResta...