Obtaining Census Tract Data in All States using TidyCensus and purr

I was pleasantly surprised how quick purr is to use with TidyCensus to get data for all Census Tracts in America. This code is based on Matt Herman’s example, but I used R’s built in state.abb to get a list of all states. To only the CONUS Census Tracts, you could use state.abb %>% setdiff(c('AK','HI')), which uses R’s built in setdiff to remove AK and HI from the list of states pulled.

acs <- map_dfr(
  state.abb,
  ~get_acs("tract", survey='acs5', var='B01001_001', state=., cache_table = T,
               geometry = T,
               year = 2021)
  )
Map: Granger State Forest
Map: Peter Scott Swamp Freshwater Wetlands
Map: Point Peninsula Wildlife Management Area
Map: South Hill State Forest
Map: Urbana And Pigtail Hollow State Forests
Terrain Map: Brewerton
Terrain Map: Oswego Boulevard Expressway in 1958
Terrain Map: Saratoga - Ballston Spa
Terrain Map: The GAL And Rapp Road Hillshade
Terrain Map: Weedsport
Thematic Map: 2020 Bethlehem Proposition 2
Thematic Map: Before the Sprawl in Delmar
Thematic Map: Buildings Today Vs 1952 In Greenville, NY
Thematic Map: Farms on the Outskirks of Delmar
Photo: LaGrange Road
Photo: Bald Eagle
Photo: Across the Lake
Photo: Old Bridge Along Gorge Trail
Photo: Always Muddy
Photo: Meads Road
Photo: Moss Lake
Photo: Entrance to Hyde Hall
Photo: Orchard Road
Photo: Ledge

Leave a Reply

Your email address will not be published. Required fields are marked *