Skip to content

Instantly share code, notes, and snippets.

@walkerke
Created November 16, 2022 00:04
Show Gist options
  • Save walkerke/2d4785622ee1852edeca0c4890d344bd to your computer and use it in GitHub Desktop.
Save walkerke/2d4785622ee1852edeca0c4890d344bd to your computer and use it in GitHub Desktop.
library(tigris)
library(tidyverse)
library(sf)
smallwood <- places("NY", cb = TRUE) %>%
filter(str_detect(NAME, "Smallwood"))
smallwood_roads <- roads("NY", "Sullivan") %>%
st_intersection(smallwood) %>%
filter(st_is(., "LINESTRING"))
ggplot(smallwood_roads) +
geom_sf() +
theme_minimal(base_size = 16) +
labs(title = "Roads in Smallwood, NY",
caption = "tigris R package | @kyle_e_walker")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment