Compared to class()
, this always returns the class vector that is
used for dispatch. This is most important for objects where the
class attribute has not been set.
Examples
s3_class(NULL)
#> [1] "NULL"
s3_class(logical())
#> [1] "logical"
s3_class(integer())
#> [1] "integer" "numeric"
s3_class(numeric())
#> [1] "double" "numeric"
s3_class(character())
#> [1] "character"
s3_class(matrix())
#> [1] "matrix" "logical"
s3_class(matrix(1))
#> [1] "matrix" "double" "numeric"
s3_class(array())
#> [1] "array" "logical"
s3_class(array(1))
#> [1] "array" "double" "numeric"