Entering edit mode
Javier Pérez Florido
▴
840
@javier-perez-florido-3121
Last seen 6.8 years ago
Dear list,
I have a code sample in which a single assignment is returned. What I
want to do is to collect all warning messages found in the example
(they
are forced in this example) and to go on after a warning message is
found. I've tried with invokeRestart function, but it doesn't work.
Any
tips??
testTryCatch<-function()
{
myWarnings <- NULL
tryCatch({
a<-3
b<-a+6
warning("hello1")
c<-6+13
warning("hello2")
return(c)
},warning=function(ex){
myWarnings <<- c(myWarnings, list(ex))
#some code (like invokeRestart("muffleWarning")) to go on
executing in c<-6+13, but it doesn't work
},error=function(ex){
cat("error found")
},finally={
print(myWarnings)
}
)
}
Thanks,
Javier