Learn R Programming

qrmtools (version 0.0-15)

catch: Catching Results, Warnings and Errors Simultaneously

Description

Catches results, warnings and errors.

Usage

catch(expr)

Value

list with components:

value

value of expr or NULL in case of an error.

warning

warning message (see simpleWarning or warning()) or NULL in case of no warning.

error

error message (see simpleError or stop()) or NULL in case of no error.

Arguments

expr

expression to be evaluated, typically a function call.

Author

Marius Hofert (based on doCallWE() and tryCatch.W.E() in the R package simsalapar).

Details

This function is particularly useful for large(r) simulation studies to not fail until finished.

Examples

Run this code
catch(log(2))
catch(log(-1))
catch(log("a"))

Run the code above in your browser using DataLab