Data types
R has 4 basic data types.character
numeric (real or decimal)
integer
logical
character: "a", "swc"
numeric: 2, 15.5
integer: 2L (the L tells R to store this as an integer)
logical: TRUE, FALSE
R provides many functions to examine features of vectors and other objects, for example
class() - what kind of object is it (high-level)?
typeof() - what is the object’s data type (low-level)?
length() - how long is it? What about two dimensional objects?
attributes() - does it have any metadata?
An “empty” object may still have a mode. For example
> e <- numeric()
makes e an empty vector structure of mode numeric. Similarly character() is a empty character vector, and so on.