Selecting multiple elements with [

x can be a vector, a data frame (selecting columns!), a list!

  • using vector of (integer) indices
x[c(3, 2, 5)]
x[c(-1, -2)]
x[3:5]