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 ...

Get Learning Shiny now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.