Data Structures

Arrays

  1. Explain how an array generalizes a vector.
  2. Construct a given 2D array using the array function.
  3. Explain (roughly) how a computer stores data structures in memory.
  4. Compare and contrast column-major and row-major order for storing 2D arrays.
  5. State which of column-major or row-major order R uses by default.
  6. Use the [ ] operator to access a single element of a 2D array both (a) using a pair of integer indices and (b) using a single integer index.
  7. Use the [ ] operator to access rows or columns of a 2D array.

Matrices

  1. Construct a given matrix using the matrix function.

Lists

  1. Explain how a list generalizes a vector.
  2. Compare and constrast how the [ ] and [[ ]] operators access a list.
  3. Access the elements of a list using both [ ] and [[ ]].
  4. Use the function c to extend a vector or list.
  5. Use the length function to query the length of a vector or list.
  6. Use the length function to shorten a vector or list.
  7. Use the names function to name the elements of a list.
  8. Access the elements of a named list using both [ ] and [[ ]].
  9. Access the elements of a named list using the $ operator.
  10. Generate a named list using the list function.

Data Frames

  1. Explain how a data frame generalizes a matrix.
  2. Construct a data frame using the data.frame function.

Accessing Vectors, Arrays, Lists, and Data Frames

  1. Access a collection of elements in a vector, array, list, or data frame using positive integers.
  2. Access all-but a collection of elements in a vector, array, list, or data frame using negative integers.
  3. Explain what the : operator does in a command such as 1:10.
  4. Access entire rows or columns of a matrix or data frame using the [i, ] or [, j] syntax for the [ ] operator.
  5. Explain how a vector of Booleans can be used to access the elements of a vector.