Skip to content

Instantly share code, notes, and snippets.

@walkerke
Created November 7, 2018 14:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walkerke/050c9113fc2aabdd0d1c96bf7add606b to your computer and use it in GitHub Desktop.
Save walkerke/050c9113fc2aabdd0d1c96bf7add606b to your computer and use it in GitHub Desktop.
library(tigris)
library(tidyverse)
options(tigris_class = "sf")
# Get a vector of county codes
ia_counties <- counties("IA", cb = TRUE, resolution = "20m") %>%
pull(COUNTYFP)
# Iterate through the county codes and combine the result
ia_roads <- map(ia_counties, ~{
roads(state = "IA", county = .x)
}) %>%
rbind_tigris()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment