powered by
Catches results, warnings and errors.
catch(expr)
list with components:
list
value
value of expr or NULL in case of an error.
expr
NULL
warning
warning message (see simpleWarning or warning()) or NULL in case of no warning.
simpleWarning
warning()
error
error message (see simpleError or stop()) or NULL in case of no error.
simpleError
stop()
expression to be evaluated, typically a function call.
Marius Hofert (based on doCallWE() and tryCatch.W.E() in the R package simsalapar).
doCallWE()
tryCatch.W.E()
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 DataLab