Learn R Programming

xfun (version 0.48)

try_error: Try an expression and see if it throws an error

Description

Use tryCatch() to check if an expression throws an error.

Usage

try_error(expr)

Value

TRUE (error) or FALSE (success).

Arguments

expr

An R expression.

Examples

Run this code
xfun::try_error(stop("foo"))  # TRUE
xfun::try_error(1:10)  # FALSE

Run the code above in your browser using DataLab