Catches results, warnings and errors.
catch(expr)
An expression to be evaluated, typically a function call.
A list with components:
list
value
The value of expr or NULL in case of an error.
expr
NULL
warning
The warning message (see simpleWarning or warning()) or NULL in case of no warning.
simpleWarning
warning()
error
The error message (see simpleError or stop()) or NULL in case of no error.
simpleError
stop()
This function is particularly useful for large(r) simulation studies to not fail until finished.
catch(log(2)) catch(log(-1)) catch(log("a"))
Run the code above in your browser using DataCamp Workspace