Code
library(sf)
library(tidyverse)
# Load DC tracts data
<- "data/DC_Census_2020/Census_Tracts_in_2020.shp"
dc_sf_fpath <- st_read(dc_sf_fpath, quiet = TRUE)
dc_sf <- c("OBJECTID", "TRACT", "GEOID", "ALAND", "AWATER", "STUSAB", "SUMLEV", "GEOCODE", "STATE", "NAME", "POP100", "HU100", "geometry")
cols_to_keep <- dc_sf |> select(cols_to_keep)
dc_sf # We can extract the geometry with the st_geometry function
<- st_geometry(dc_sf)
dc_geo # And plot the geometry with base R's plot() function
plot(dc_geo, mar = c(0,0,0,0))