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

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

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -