ComeçarComece de graça

Joining data from tigris and tidycensus

Geometry is currently supported in tidycensus for geographies in the core Census hierarchy - state, county, Census tract, block group, and block - as well as zip code tabulation areas. However, you may be interested in mapping data for other geographies. In this case, you can download the equivalent boundary file from the Census Bureau using the tigris package and join your demographic data to it for mapping.

Este exercício faz parte do curso

Analyzing US Census Data in R

Ver curso

Instruções do exercício

  • Get median household income by unified school district in Idaho by using the geography identifier "school district (unified)".
  • Get unified school district boundaries in Idaho using the school_districts() function.
  • Join the two datasets together with left_join().

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Get an income dataset for Idaho by school district
idaho_income <- ___(___ = ___, 
                        variables = "B19013_001", 
                        ___ = "ID")

# Get a school district dataset for Idaho
idaho_school <- ___(state = "ID", type = "unified", class = "sf")

# Join the income dataset to the boundaries dataset
id_school_joined <- ___(idaho_school, ___, ___ = "GEOID")

plot(id_school_joined["estimate"])
Editar e executar o código