r - Make result in tryCatch expr available to warning handler -


in usual implementation of trycatch, warning handler returns custom value, e.g.

trycatch(expr,   warning = function(w) { print(w) ; return(null) } 

what if want warning handler return result of expr without running expr again? (the reason expr api call cuts limit.) tried

trycatch({res <- expr; return(res)},       warning = function(w) { print(w) ; return(res) } 

but of course doesn't work because res not available in warning handler.


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -