try_silent: Try an expression silently

View source: R/try_silent.R

try_silentR Documentation

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)

Arguments

expr

[expression]
An R expression to be evaluated.

Details

This function is a wrapper for try.

Value

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

See Also

Other function helpers: do.call_timed(), function_arguments(), function_body(), function_defaults(), quiet(), timed(), variable_name()

Examples

## Not run: 
try_silent(1 + 1)
try_silent(1 + "1")

## End(Not run)

oeli documentation built on April 3, 2025, 9:29 p.m.