assertive.types (version 0.0-1)

assert_is_all_of: Does x belong to these classes?

Description

Checks to see if x belongs to any of the classes in classes.

Usage

assert_is_all_of(x, classes, severity = getOption("assertive.severity",
  "stop"))

assert_is_any_of(x, classes, severity = getOption("assertive.severity",
  "stop"))

Arguments

x
Input to check.
classes
As for class.
severity
How severe should the consequences of the assertion be? Either "stop", "warning", "message", or "none".

Value

  • The functions return nothing but throw an error if x does not have any/all of the class classes.

See Also

is2

Examples

Run this code
assert_is_all_of(1:10, c("integer", "numeric"))
#These examples should fail.
assertive.base::dont_stop(assert_is_any_of(1:10, c("list", "data.frame")))

Run the code above in your browser using DataCamp Workspace