Selecting columns

Author

Jeffrey R. Stevens

Published

February 12, 2025

For these exercises, we’ll use the iris data set build into base R.

  1. View iris to see what it looks like.
# >
  1. Return a data frame with only the sepal columns using inclusion.
# >
  1. Return a data frame with only the sepal columns using a helper function.
# >
  1. Return a data frame with the sepal and petal columns using a helper function.
# >
  1. Return a data frame with the sepal and petal columns using exclusion.
# >
  1. Move Species to be the first column using select() and a helper function.
# >
  1. Move Species to be the first column using relocate().
# >
  1. Rename Species to species using select() and a helper function.
# >
  1. Rename Species to species using rename().
# >