Tidycensus - One year ACS for All Counties in a State

170 views Asked by At

Pretty simple problem, I think, but not sure of the proper solution. Have done some research on this and think I recall seeing a solution somewhere, but cannot remember where...anyway,

Want to get DP03, one-year acs data for all Ohio counties, year 2019. However, The code below only accesses 39 of Ohio's 88 counties. How can I access the remaining counties?

My guess is that data is only being pulled for counties with populations greater than 60,000.

library(tidycensus)
library(tidyverse)


acs_2019 <- load_variables(2019, dataset = "acs1/profile")

DP03 <- acs_2019 %>% 
  filter(str_detect(name, pattern = "^DP03")) %>% 
  pull(name, label)

Ohio_county <- 
  get_acs(geography = "county",
          year = 2019,
          state = "OH",
          survey = "acs1",
          variables = DP03,
          output = "wide")

This results in a table that looks like this...

Ohio_county
# A tibble: 39 x 550
   GEOID NAME  `Estimate!!EMPL~ `Estimate!!EMPL~ `Estimate!!EMPL~ `Estimate!!EMPL~ `Estimate!!EMPL~
   <chr> <chr>            <dbl>            <dbl>            <dbl>            <dbl>            <dbl>
 1 39057 Gree~           138295              815           138295               NA            87465
 2 39043 Erie~            61316              516            61316               NA            38013
 3 39153 Summ~           442279             1273           442279               NA           286777
 4 39029 Colu~            83317              634            83317               NA            48375
 5 39099 Maho~           188298              687           188298               NA           113806
 6 39145 Scio~            60956              588            60956               NA            29928
 7 39003 Alle~            81560              377            81560               NA            49316
 8 39023 Clar~           108730              549           108730               NA            64874
 9 39093 Lora~           250606              896           250606               NA           150136
10 39113 Mont~           428140              954           428140               NA           267189

Pretty sure I've seen a solution somewhere, but cannot recall where.

Any help would be appreciated since it would let the office more easily pull census data rather than wading through the US Census Bureau site. Best of luck and Thank you!

1

There are 1 answers

0
James Crumpler On

My colleague, who already pulled the data, did not specify whether or not the DP03 data came from the ACS 1 year survey or the ACS 5 year survey. As it turns out, it was from the ACS 5 year survey, which includes all Ohio counties, not just those counties over 65,000 population. Follow comments above for a description of how this answer was determined.

Code for all counties is here

library(tidycensus)
library(tidyverse)

acs_2018 <- load_variables(2018, dataset = "acs5/profile")


DP03 <- acs_2019 %>% 
  filter(str_detect(name, pattern = "^DP03")) %>% 
  pull(name)

Ohio_county <- 
  get_acs(geography = "county",
          year = 2018,
          state = "OH",
          survey = "acs5",
          variables = DP03,
          output = "wide")