NamedTypeTest-class {TypeInfo} | R Documentation |
These classes are for specifying a test on the type of an object
using the class of that object and comparing it to target class
names. The tests can be either for
x inherits from class name
(or is(x, "className")
)
or x is an instance of class name
(i.e. class(x) ==
"className"
).
The first of these is represented by InheritsTypeTest
and the second by StrictTypeTest
.
Objects can be created for the non-virtual classes
using new("InheritsTypeTest",...)
and new("StrictIsTypeTest",...)
or the convenience functions
InheritsTypeTest(...)
, StrictIsTypeTest(...)
Additionally, where appropriate,
a character vector is coerced to InheritsTypeTest
.
.Data
:"character"
.
This is an internal data type to represent the class names.
It is not to be used directly. It is inherited from the
“character” class.
Class "character"
, from data part.
Class "ClassNameOrExpression"
, directly.
Class "vector"
, by class "character"
.
signature(from = "character", to =
"NamedTypeTest")
:
converts a character vector into a InheritsTypeTest
.Duncan Temple Lang <duncan@wald.ucdavis.edu>
TypedSignature
TypeSpecification-class
DynamicTypeTest-class
new("InheritsTypeTest", c("A", "B")) m = array(1:60, c(3, 4, 5)) tt = new("StrictIsTypeTest", c("matrix")) TypeInfo:::checkType(m, tt) tt = new("StrictIsTypeTest", c("array")) TypeInfo:::checkType(m, tt)