Assuming a fresh R installation, a clean .Rprofile, no additional packages loaded, and no previous calls of the kind class(x) <- "new.class": What are the possible return values of class(x)?
class in RThe question is: What are the possible values class can take in R? In R, users can define their own classes (as many as you want). Try creating a class for object x using class(x) <- "new.class".
But, at a clean install, R starts with this list of basic classes.
Inspect the class of an object using class().
Atomic classes
Classes help describe the type of data contained in a vector. Coercion (changing classes) moving up the subsequent list is safe—it will preserve information. But changing class downward may lose information.
c("hello", "world")c(as.complex(-1), 2i)c(as.integer(10), 3L) c(100, .5)c(TRUE, FALSE)Other common classes
Classes also help describe the logical structure of the data. (Note: type is the physical structure of the data, and sometimes the class is the same as the type thanks to inheritance.)
class(my.atomic.vector) will return one of the value from the list above, all elements are homogenousFind defined classes in R
I had the same question and to me a the best way to find out the defined classes was to simply type in is. and see what appears in the autocompletion menu. Like this:

As you can see you get a list which even considers the loaded packages. Here I have ggplot2 loaded and the corresponding classes are shown in the menu, too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With