Vectors & Matrices

Estimated Completion Time

About 60–75 minutes, including practice exercises and knowledge quizzes.

In this module, we’ll cover two of R’s most fundamental data structures: vectors and matrices. Vectors, in particular, form the foundation of nearly every type of object you’ll encounter in R. The more complex types of object that you’ll encounter later (lists, data frames, factors) are all built from vectors. Getting to grips with vectors and matrices early in your R journey will make everything that follows easier.

This module’s content is split into two tutorials:

  1. Vectors
  2. Matrices

Learning Goals

After completing this module, you will be able to:

Vectors

  1. Describe the characteristics of atomic vectors.
  2. Describe the six atomic vector modes (logical, integer, double, character, complex, raw).
  3. Generate new atomic vectors using various functions.
  4. Perform element-wise arithmetic and logical operations on atomic vectors.
  5. Select and modify elements in a vector.
  6. Explain “recycling”, and describe how it works when manipulating vectors.

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. Select and modify the elements of a matrix.
  6. Explain how recycling works with matrix operations.

Click the button below to get started!

Back to top