0

New R user here looking for help with a get_data pull from TidyCensus. I’m looking to pull data on a small unit for a specific city, rather than to a county or state. For example tract data for the city of Pittsburgh or Block Group data for just Miami.

Currently, I can pull data by unit for counties or state, but then I’m not sure how to filter this to a specific city. My code below finds tracts at the larger county-based area rather than just the city.

Miami <- get_decennial(
  geography = “tract”,
  variables = "P2_001N",
  state = "FL",
  county = c("Miami-Dade", "Broward", "Palm Beach"),
  geometry = TRUE,
  year = 2020
)

Another way is that I can pull data for an urban area or an MSA but then the data is aggregated to that level rather than the tract or Black Group. At this stage, I’m not fussy on the city boundaries. Urban areas, MSA, CBSA would be fine as long as I can get data at the block, block group, or tract level for this city area.

Any suggestions are absolutely helpful!

TeaNoMilk
  • 15
  • 5
  • You might find this section of my book useful: https://walker-data.com/census-r/spatial-analysis-with-us-census-data.html#identifying-geometries-within-a-metropolitan-area. We also have an open issue over in the tigris package that would make this very simple; perhaps we'll implement in the future. – kwalkertcu Aug 25 '22 at 13:49
  • Thanks for your reply, I'll be sure to check through the book chapter. Your book/package has been hugely helpful for my work so far. – TeaNoMilk Aug 25 '22 at 15:02

0 Answers0