tryOrFailWithNA: Try to evaluate an expression, if not fail with NA (default)

View source: R/0helpers.R

tryOrFailWithNAR Documentation

Try to evaluate an expression, if not fail with NA (default)

Description

Try to evaluate an expression, if not fail with NA (default)

Usage

tryOrFailWithNA(expr, value = NA_real_)

Arguments

expr

Expression to be evaluated

value

Return value if there is an error, default is NA_real_

Value

Returns the evaluation of the expression, or value if it doesn't work out

Examples

tryOrFailWithNA(integrate(exp, -Inf, Inf)[["value"]], NA)
tryOrFailWithNA(integrate(exp, 0, 3)[["value"]], NA)

AlexanderLyNL/bstats documentation built on Sept. 11, 2023, 4:10 p.m.