Get startedGet started for free

Combining datasets of the same tigris type

Often, datasets from the US Census Bureau are available by state, which means they are available by state from tigris as well. In many instances, you'll want to combine datasets for multiple states. For example, an analysis of the Portland, Oregon metropolitan area would include areas in both Oregon and Washington north of the Columbia River; however, these areas are represented in different Census files. In this exercise, you'll learn how to combine datasets with the rbind_tigris() function.

This exercise is part of the course

Analyzing US Census Data in R

View Course

Exercise instructions

  • Use the tracts() function to get Census tract boundaries for Oregon and Washington.
  • Check the tigris attributes of each object to make sure they are the same type.
  • Use the rbind_tigris() function to combine the datasets, then plot the result.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Get Census tract boundaries for Oregon and Washington
or_tracts <- ___("OR", cb = TRUE)
wa_tracts <- tracts("WA", cb = TRUE)

# Check the tigris attributes of each object
attr(or_tracts, ___)
___(wa_tracts, "tigris")

# Combine the datasets then plot the result
or_wa_tracts <- ___(or_tracts, ___)
___(or_wa_tracts$geometry)
Edit and Run Code