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.

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