1. Learn
  2. /
  3. Courses
  4. /
  5. Data Manipulation with dplyr

Exercise

Summarizing by state and region

You can group by multiple columns instead of grouping by one. Here, you'll practice aggregating by state and region, and notice how useful it is for performing multiple aggregations in a row.

counties_selected <- counties %>%
  select(region, state, county, population)

Instructions 1/2

undefined XP
    1
    2
  • Summarize to find the total population, as a column called total_pop, in each combination of region and state, grouped in that order.