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

Exercise

Summarizing by state

Another interesting column is land_area, which shows the land area in square miles. Here, you'll summarize both population and land area by state, with the purpose of finding the density (in people per square miles).

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

Instructions 1/2

undefined XP
    1
    2
  • Group the data by state, and summarize to create the columns total_area (with total area in square miles) and total_population (with total population).