powered by
helper function
catch_warnings(expr)
a list where the first entry is the result of expr and the second provides information about warnings
expr
an R expression to evaluate
log(3) catch_warnings(log(3)) # produces warning # log(-3) # catch it catch_warnings(log(-3)) # produces error # log("x") # catch it catch_warnings(log("x"))
Run the code above in your browser using DataLab