Skip to contents

Leverages censusapi::getCensus() to download tables of census data. Tables are returned in tidy format, with variables given tidy, human-readable names.


  geo = NULL,
  sumfile = "sf1",
  pop_group = NULL,
  check_geo = FALSE,
  drop_total = FALSE,
  show_call = FALSE

  geo = NULL,
  year = 2019,
  survey = c("acs5", "acs1"),
  check_geo = FALSE,
  drop_total = FALSE,
  show_call = FALSE



The table to download, either as a character vector or a table object as produced by cens_find_dec(), cens_find_acs() or cens_parse_tables(), or as included in tables_dec and tables_acs. Note: some tables are split into A/B/C/etc. versions by race; this function unifies all of these tables under one code. So, for example, use P012, not P012A.


The geographic level to return. One of the machine-readable or human-readable names listed in the "Details" section of cens_geo(). Will return all matching geographies of this level, as filtered by the further arguments to .... For example, setting geo="tract" is equivalent to setting tract="all".


Geographies to return, as supported by the Census API. Order matters here---the first argument will be the geographic level to return (i.e., it corresponds to the geo argument) and additional arguments will filter the results. Use "all", "*", NA, or TRUE to return all units of a particular geography. See the examples of cens_geo() for details.


For decennial data, the summary file to use. SF2 contains more detailed race and household info.


For decennial data using summary file SF2, the population group to filter to. See


If TRUE, validate the provided geographies against the available geographies from the relevant Census API.


Whether to filter out variables which are totals across another variable. Recommended only after inspection of the underlying table.


Whether to show the actual call to the Census API. May be useful for debugging.


For ACS data, the survey year to get data for.


For ACS data, whether to use the one-year or five-year survey (the default). Make sure to check availability using cens_find_acs().


A tibble of census data in tidy format, with columns GEOID, NAME, variable (containing the Census variable code), value or estiamte, moe in the case of ACS tables, and additional factor columns specific to the table.


if (FALSE) {
cens_get_dec("P3", "state")
cens_get_dec(tables_sf1$H2, "state")
cens_get_dec("H2", "county", state="WA", drop_total=TRUE)

cens_get_acs("B09001", county="King", state="WA")