ComenzarEmpieza gratis

Finding the largest group by county

tidyverse data wrangling tools in packages like dplyr and purrr are extremely powerful for exploring Census data. tidycensus is specifically designed with data exploration within the tidyverse in mind. For example, users might be interested in finding out the largest racial/ethnic group within each county for a given state. This can be accomplished using dplyr grouping capabilities, which allow users to identify the largest ACS group estimate and filter to retain the rows that match that group.

Este ejercicio forma parte del curso

Analyzing US Census Data in R

Ver curso

Instrucciones del ejercicio

  • Group the ca_race dataset by the GEOID column.
  • Filter the dataset to retain those rows where the estimate value is equal to the maximum for its group (the county).
  • Use the tally() function to determine the breakdown of largest racial/ethnic groups for counties in California.

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# Group the dataset and filter the estimate
ca_largest <- ___ %>%
  group_by(___) %>%
  filter(___ == max(estimate)) 

head(ca_largest)

# Group the dataset and get a breakdown of the results
ca_largest %>% 
  ___(___) %>%
  ___()
Editar y ejecutar código