tryEval: Try to evaluate an expression and return a default value if...

View source: R/utils.R

tryEvalR Documentation

Try to evaluate an expression and return a default value if an error occurs or otherwise return its value.

Description

Try to evaluate an expression and return a default value if an error occurs or otherwise return its value.

Usage

tryEval(expr, def = NULL)

Arguments

expr

the expression to evaluate

def

the default value if an error occurs in the evaluation of expr

Examples

x <- list(a=c(x=1,y=2),b=c(x=2,p=3))
list.map(x, tryEval(x+y, NA))

renkun-ken/rlist documentation built on March 16, 2023, 8:25 p.m.