Learn R Programming

assertive.base (version 0.0-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. This function is exported for use by package developers so that they can create their own assert functions.

Usage

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

Arguments

predicate
Function that returns a logical value (possibly a vector).
...
Passed to the predicate function.
msg
The error message, in the event of failure.
what
Either 'all' or 'any', to reduce vectorised tests to a single value.
na_ignore
A logical value. If FALSE, NA values cause an error; otherwise they do not. Like na.rm in many stats package functions, except that the position of the failing values does not change.

Value

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