Learn R Programming

assertive.types (version 0.0-3)

assert_is_S4: Is the input an S4 object?

Description

Checks to see if the input is an S4 object.

Usage

assert_is_S4(x, severity = getOption("assertive.severity", "stop"))
assert_is_s4(x, severity = getOption("assertive.severity", "stop"))
assert_is_ref_class_generator(x, severity = getOption("assertive.severity", "stop"))
assert_is_ref_class_object(x, severity = getOption("assertive.severity", "stop"))
is_s4(x, .xname = get_name_in_parent(x))
is_S4(x, .xname = get_name_in_parent(x))
is_ref_class_generator(x, .xname = get_name_in_parent(x))
is_ref_class_object(x, .xname = get_name_in_parent(x))

Arguments

x
Input to check.
severity
How severe should the consequences of the assertion be? Either "stop", "warning", "message", or "none".
.xname
Not intended to be used directly.

Value

is_S4 wraps isS4, providing more information on failure. assert_is_S4 returns nothing but throws an error if is_S4 returns FALSE.

See Also

isS4.

Examples

Run this code
assert_is_s4(getClass("MethodDefinition"))
# These examples should fail.
assertive.base::dont_stop(assert_is_s4(1:10))

Run the code above in your browser using DataLab