Learn R Programming

assertive (version 0.2-6)

assert_is_inherited_from: Does the object inherit from some class?

Description

Checks to see if an object is inherited from any of the specifed classes.

Usage

assert_is_inherited_from(x, classes)

is_inherited_from(x, classes, .xname = get_name_in_parent(x))

Arguments

x
Any R variable.
classes
A character vector of classes.
.xname
Not intended to be used directly.

Value

  • TRUE if x inherits from at least one of the classes, as determined by inherits.

See Also

inherits, is2

Examples

Run this code
x <- structure(1:5, class = c("foo", "bar"))
assert_is_inherited_from(x, c("foo", "baz"))
dont_stop(assert_is_inherited_from(x, c("Foo", "baz")))

Run the code above in your browser using DataLab