How can I filter out the small Hawaiian islands with get_acs?

144 Views Asked by At

Can you use the resolution argument in get_acs() to filter out the small islands in the Hawaiian archipelago?

I might have found a bug in tidycensus, one of my favorite packages.

I was mapping U.S congressional districts using tidycensus's get_acs() function, but I was getting that long archipelago northwest of Hawaii. I tried following Kyle Walker's tip to include the resolution = "20m" argument to filter out the small islands, but the archipelago wouldn't go away. I eventually just grabbed the geometry using the congressional_districts() function and joined the get_acs() data.

MRE:

#map with too many islands
cds <- get_acs(
  geography = "congressional district",
  variables = "B01003_001",
  geometry = TRUE,
  resolution = "20m"
) %>% shift_geometry()

cds %>%
  ggplot() +
  geom_sf()

Bad map:

img1

What worked:

#map with the right number of islands
cds2 <- congressional_districts(cb = TRUE,
                                resolution = "20m") %>% shift_geometry()

cds2 %>%
  ggplot() +
  geom_sf()

Good map:

img2

1

There are 1 best solutions below

0
kwalkertcu On

I fixed this in the latest CRAN release of tigris (sent it in last week); if you re-install tigris your original code will return the desired results.