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