Data Types

In this module, we’ll cover five of the most ubiquitous and useful data types in R. These structures form the foundation of nearly all data manipulation and data analysis workflows in R. Hence, understanding how these data types work, how they relate/differ, and their relative use-cases is essential for writing effective and reliable R code. Each tutorial focusses on a specific data type:

  1. Vectors
  2. Matrices
  3. Lists
  4. Data Frames
  5. Factors

Learning Goals

After completing this module, you will be able to:

Vectors

  1. Describe the characteristics of atomic vectors, and explain their fundamental role in the R data system.
  2. Describe the six atomic vector modes (logical, integer, double, character, complex, raw).
  3. Generate new atomic vectors using various functions.
  4. Performing element-wise arithmetic and logical operations on atomic vectors.
  5. Select and modify elements in a vector.

Matrices

  1. Describe the characteristics of an R matrix.
  2. Explain the relationship between matrices and vectors.
  3. Create new matrices in R.
  4. Perform element-wise operations on matrices.
  5. Explain how recycling works with matrix operations.
  6. Select and modify the elements of a matrix.

Lists

  1. Describe the characteristics of an R list.
  2. Describe important use-cases for lists, and explain why lists are the best choice in these situations.
  3. Create new lists in R.
  4. Access and modify list elements using different methods and explain the difference between the available selection operators.

Data Frames

  1. Describe the characteristics of data frames.
  2. Explain important use-cases for data frames, and explain why data frames are the best choice in these situations.
  3. Explain how data frames and lists are related.
  4. Explain the differences between data frames and matrices.
  5. Create new data frames in R.
  6. Use list-style and matrix-style indexing to access and modify the elements of a data frame.
  7. Explain the different effects of the available selection operators.
  8. Explain how recycling works with data frames.

Factors

  1. Describe the characteristics of an R factor.
  2. Explain how factors differ from atomic vectors.
  3. Generate new factors in R.
  4. Access and modify factor levels.
  5. Describe important use-cases for Factors, and explain why factors are the best choice in these situations.

Click the button below to get started with the first tutorial.

Back to top