powered by
Checks to see if the object is an S4 object with a particular slot.
assert_has_slot(x, severity = getOption("assertive.severity", "stop"))has_slot(x, slotname, .xname = get_name_in_parent(x))
has_slot(x, slotname, .xname = get_name_in_parent(x))
Input to check. Intended to be an S4 object.
How severe should the consequences of the assertion be? Either "stop", "warning", "message", or "none".
"stop"
"warning"
"message"
"none"
A string naming a slot to check for.
Not intended to be used directly.
has_names returns TRUE if names is non-null.
has_names
TRUE
names
slot
# NOT RUN { setClass("numbers", representation(foo = "numeric")) x <- new("numbers", foo = 1:10) has_slot(x, "foo") has_slot(x, "bar") has_slot(1:10, "foo") # }
Run the code above in your browser using DataLab