Learn R Programming

assertive (version 0.2-1)

assert_engine: Throws an error if a condition isn't met.

Description

The workhorse of the package. If a condition isn't met, then an error is thrown.

Usage

assert_engine(x, predicate, msg, what = c("all", "any"), ...)

Arguments

x
Input to check. If missing, pass no args to predicate.
predicate
Function that returns a logical value (possibly a vector).
msg
The error message, in the event of failure.
what
Either 'all' or 'any', to reduce vectorised tests to a single value.
...
Passed to the predicate function.

Value

  • FALSE with the attribute message, as provided in the input.