Determine the class of an arbitrary R object.
- an R object.
character string giving the class of
x.The class is the (first element) of the
classattribute if this is non-
NULL, or inferred from the object's
dimattribute if this is non-
data.class(x)returns what is typically useful for method dispatching. (Or, what the basic creator functions already and maybe eventually all will attach as a class attribute.)
For compatibility reasons, there is one exception to the rule above:
integer, the result of
"numeric" even when
x is classed.
x <- LETTERS data.class(factor(x)) # has a class attribute data.class(matrix(x, ncol = 13)) # has a dim attribute data.class(list(x)) # the same as mode(x) data.class(x) # the same as mode(x) stopifnot(data.class(1:2) == "numeric") # compatibility "rule"
Looks like there are no examples yet.