This is used as the interface between S7 and R's other OO systems, allowing you to use S7 classes and methods with base types, informal S3 classes, and formal S4 classes.
Usage
as_class(x, arg = deparse(substitute(x)))
Arguments
- x
A class specification. One of the following:
An S7 class (created by
new_class()
).An S7 union (created by
new_union()
).An S3 class (created by
new_S3_class()
).An S4 class (created by
methods::getClass()
ormethods::new()
).A base class, like class_logical, class_integer, or class_double.
A "special", either class_missing or class_any.
- arg
Argument name used when generating errors.
Value
A standardised class: either NULL
, an S7 class, an S7 union,
as new_S3_class, or a S4 class.
Examples
as_class(class_logical)
#> <S7_base_class>: <logical>
as_class(new_S3_class("factor"))
#> <S7_S3_class>: S3<factor>