Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

try_default

Try, with default in case of error.


Description

try_default wraps try so that it returns a default value in the case of error. tryNULL provides a useful special case when dealing with lists.

Usage

try_default(expr, default, quiet = FALSE)

tryNULL(expr)

Arguments

expr

expression to try

default

default value in case of error

quiet

should errors be printed (TRUE) or ignored (FALSE, default)

See Also


plyr

Tools for Splitting, Applying and Combining Data

v1.8.6
MIT + file LICENSE
Authors
Hadley Wickham [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.