Day 16 Minimal

Code source

Minimal Roads from https://twitter.com/kyle_e_walker/status/1592857115928199169

Uses the {tigris} package which downloads shapefiles from the United States Census Bureau and loads them into R as ‘sf’ objects.

Code to download the data

library(tigris)
library(tidyverse)
library(sf)

smallwood <- places("WA", cb = TRUE) %>%
  filter(str_detect(NAME, "Winthrop"))

smallwood_roads <- roads("WA", "Okanogan County") %>%
  st_intersection(smallwood) %>%
  filter(st_is(., "LINESTRING"))

Plot code

ggplot(smallwood_roads) + 
  geom_sf() + 
  theme_minimal(base_size = 16) + 
  labs(title = "Roads in Winthrop, WA")