Mode, Class and Type of R objects I was wondering what are the differences between Mode, Class and Type of R objects?
Type of a R object can be obtained by typeof() function, mode by mode(), and class by class(). 
Also any other similar functions and concepts that I missed?
Thanks and regards!
 A: From: https://www.mail-archive.com/r-help@r-project.org/msg17169.html :
'mode' is a mutually exclusive classification of objects according to
their basic structure.  The 'atomic' modes are numeric, complex,
character and logical.  Recursive objects have modes such as 'list' or
'function' or a few others.  An object has one and only one mode.
'class' is a property assigned to an object that determines how generic
functions operate with it.  It is not a mutually exclusive
classification.  If an object has no specific class assigned to it, such
as a simple numeric vector, it's class is usually the same as its mode,
by convention.
Changing the mode of an object is often called 'coercion'.  The mode of
an object can change without necessarily changing the class.
A: The class() is used to define/identify what "type" an object is from the point of view of object-oriented programming in R. So for
> x <- 1:3
> class(x)
[1] "integer"

any generic function that has an "integer" method will be used.
typeof() gives the "type" of object from R's point of view, whilst mode() gives the "type" of object from the point of view of Becker, Chambers & Wilks (1988). The latter may be more compatible with other S implementations according to the R Language Definition manual.
I'd probably err on the side of using typeof() in most cases unless it was for passing R objects to compiled code, where storage.mode() will be useful.
This is usefully discussed in the R Language Definition as linked to above.
A: The main difference between class and typeof is that the first can be defined by the user, but the type cannot. For example, define a list
> x<-list("a",c(1,2))

> # x is a list
> class(x)
[1] "list"
> # class can be user defined
> class(x)<-"newclass"
> class(x)
[1] "newclass"

> typeof(x)
[1] "list"
# you cannot assign a different type using typeof()
> typeof(x)<-"newclass"
Error in typeof(x) <- "newclass" : could not find function "typeof<-" 

To give a certain class name to a user defined object is very useful to write programs. It allows to tag user defined objects in a similar way to what happens in object-oriented programming languages. 
