Learn R Programming

oeli (version 0.5.0)

try_silent: Try an expression silently

Description

This function tries to execute expr and returns a string with the error message if the execution failed.

Usage

try_silent(expr)

Value

Either the value of expr or in case of a failure an object of class fail, which contains the error message.

Arguments

expr

An R expression to try.

Details

This function is a wrapper for try.

Examples

Run this code
if (FALSE) {
try_silent(1 + 1)
try_silent(1 + "1")
}

Run the code above in your browser using DataLab