Counting by region
The counties
dataset contains columns for region, state, population, and the number of citizens, which we selected and saved as the counties_selected
table. In this exercise, you'll focus on the region
column.
counties_selected <- counties %>%
select(county, region, state, population, citizens)
This exercise is part of the course
Data Manipulation with dplyr
Exercise instructions
- Use
count()
to find the number of counties in each region, using a second argument to sort in descending order.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Use count to find the number of counties in each region
counties_selected %>%
___