Learn R Programming

functools (version 0.2.0)

Fail_With: Fail with a default value.

Description

Fail_With() turns a function that throws an error into a function that returns a default value when there is an error. The essence of Fail_With() is simple: it is just a wrapper around try(), the function that captures errors and allows execution to continue.

Usage

Fail_With(.default = NULL, .f, .silent = FALSE)

Arguments

.default
default value.
.f
any function that throws an error.
.silent
logical: should the report of error messages be suppressed?

Value

a function that returns a default value when there's an error.

See Also

Other function operators: Compose, %O%; Memoise; Partial; Reduce_Right