Classes in depth
R has the following six fundamental or atomic classes:
- Character: When assigning a character value to a variable, the corresponding string must be quoted.
- Numeric: Decimal numbers.
- Integer: Non-decimal numbers.
- Complex: Complex numbers.
- Logical:
TRUE
/FALSE
values. - Raw: As explained in the help section of R—the raw type is intended to hold raw bytes. This is very rarely used.
All the rest of the classes that can be built in R are combinations of these six. In the later sections, you will find a list of the most common ones.
Vectors
Vectors are objects that contain elements of only one atomic class. The type of the vector will be the same as the elements it contains (for example, a numeric vector or a character vector). It is important to keep in mind that, as is the case with variables, if a value is added to a vector that does not correspond to the vector type, R will eventually change the vector type in order to adjust it to all the values in the vector instead of throwing...