IniziaInizia gratis

Counting citizens by state

You can weigh your count by particular variables rather than finding the number of counties. In this case, you'll find the number of citizens in each state.

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

Questo esercizio fa parte del corso

Data Manipulation with dplyr

Visualizza il corso

Istruzioni dell'esercizio

  • Count the number of counties in each state, weighted based on the citizens column, and sorted in descending order.

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# Find number of counties per state, weighted by citizens, sorted in descending order
counties_selected %>%
  ___
Modifica ed esegui il codice