НачатьНачать бесплатно

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.

Это упражнение является частью курса

Analyzing US Census Data in R

Посмотреть курс

Инструкции к упражнению

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

Интерактивное практическое упражнение

Попробуйте выполнить это упражнение, дополнив этот пример кода.

# 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)
Редактировать и запускать код