Data Structures
Arrays
- Explain how an array generalizes a vector.
- Construct a given 2D array using the
array
function.
- Explain (roughly) how a computer stores data structures in memory.
- Compare and contrast column-major and row-major order for storing 2D arrays.
- State which of column-major or row-major order R uses by default.
- 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.
- Use the
[ ]
operator to access rows or columns of a 2D array.
Matrices
- Construct a given matrix using the
matrix
function.
Lists
- Explain how a list generalizes a vector.
- Compare and constrast how the
[ ]
and [[ ]]
operators access a list.
- Access the elements of a list using both
[ ]
and [[ ]]
.
- Use the function
c
to extend a vector or list.
- Use the
length
function to query the length of a vector or list.
- Use the
length
function to shorten a vector or list.
- Use the
names
function to name the elements of a list.
- Access the elements of a named list using both
[ ]
and [[ ]]
.
- Access the elements of a named list using the
$
operator.
- Generate a named list using the
list
function.
Data Frames
- Explain how a data frame generalizes a matrix.
- Construct a data frame using the
data.frame
function.
Accessing Vectors, Arrays, Lists, and Data Frames
- Access a collection of elements in a vector, array, list, or data frame using positive integers.
- Access all-but a collection of elements in a vector, array, list, or data frame using negative integers.
- Explain what the
:
operator does in a command such as 1:10
.
- Access entire rows or columns of a matrix or data frame using the
[i, ]
or [, j]
syntax for the [ ]
operator.
- Explain how a vector of Booleans can be used to access the elements of a vector.