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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -