Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tidycensus::get_acs() does not have the limitations that tigris::zctas() does for specifying state for a given year #564

Open
gah-bo opened this issue Mar 27, 2024 · 0 comments

Comments

@gah-bo
Copy link

gah-bo commented Mar 27, 2024

I am working with data at the ZIPCODE-YEAR level for 2015-2021, and wanted to merge in ZCTA shapes for mapping...

tigris::zctas() does not allow setting the state parameter unless year is set to 2000 or 2010 ... In contrast, with tidycensus::get_acs(geography = "zcta") we can specify state if year is between 2011 and 2019. It does fail if year is outside the range though...

  1. Why are the years for which one can specify state when dowloading ZCTA data not the same for both libraries?
  2. On a related note, are ZCTA geometry returned by these two functions the same for a given year (so long as relevant parameters, like cb, are set to the same value as well)?

Side note: it was only through Chapter 7 of Analyzing US Census Data that I realized that (it is implied) get_acs() has cb = TRUE as default, whereas zctas() has cb = FALSE as default according to its documentation...I could not find any tidycensus documentation confirming the former, though...

library(dplyr)
library(purrr)
library(tidycensus)


QUERY_YEAR <- 2011:2019
names(QUERY_YEAR) <- QUERY_YEAR

census_data <- map_dfr(
  QUERY_YEAR,
  ~ {
    get_acs(
      geography = "zcta", 
      state = c("36"),
      variables = c("B06009_002"),
      year = .x,
      geometry = TRUE,
      cb = FALSE,
      show_call = TRUE
    )
  },
  .id = "YEAR"
) 

Edit: Follow-up comments on issue #378 are relevant... Thread has answers for why the code doesn't work from 2020 onward. However it doesn't answer why 2011-2019 even work in the first place, when they don't work for zctas()...unless, perhaps, the answer is that get_acs() actually uses filter_by argument in zctas() ?

@gah-bo gah-bo changed the title tidycensus::get_acs(geography = "zcta") vs tigris::zctas() tidycensus::get_acs() does not have the limitations that tigris::zctas() does for specifying state for a given year Mar 27, 2024
@gah-bo gah-bo changed the title tidycensus::get_acs() does not have the limitations that tigris::zctas() does for specifying state for a given year tidycensus::get_acs() does not have the limitations that tigris::zctas() does for specifying state for a given year Mar 27, 2024
@gah-bo gah-bo changed the title tidycensus::get_acs() does not have the limitations that tigris::zctas() does for specifying state for a given year tidycensus::get_acs() does not have the limitations that tigris::zctas() does for specifying state for a given year Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant