LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Analyzing US Census Data in R

Kurs anzeigen

Anleitung zur Übung

  • 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().

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# 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"])
Code bearbeiten und ausführen