S7_inherits | R Documentation |
S7_inherits()
returns TRUE
or FALSE
.
check_is_S7()
throws an error if x
isn't the specified class
.
S7_inherits(x, class = NULL)
check_is_S7(x, class = NULL, arg = deparse(substitute(x)))
x |
An object |
class |
An S7 class or |
arg |
Argument name used in error message. |
S7_inherits()
returns a single TRUE
or FALSE
.
check_is_S7()
returns nothing; it's called for its side-effects.
Starting with R 4.3.0, base::inherits()
can accept an S7 class as
the second argument, supporting usage like inherits(x, Foo)
.
Foo1 <- new_class("Foo1")
Foo2 <- new_class("Foo2")
S7_inherits(Foo1(), Foo1)
check_is_S7(Foo1())
check_is_S7(Foo1(), Foo1)
S7_inherits(Foo1(), Foo2)
try(check_is_S7(Foo1(), Foo2))
if (getRversion() >= "4.3.0")
inherits(Foo1(), Foo1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.