cens_get_dec | R Documentation |
Leverages censusapi::getCensus()
to download tables of census data. Tables
are returned in tidy format, with variables given tidy, human-readable names.
cens_get_dec(
table,
geo = NULL,
...,
sumfile = "sf1",
pop_group = NULL,
check_geo = FALSE,
drop_total = FALSE,
show_call = FALSE
)
cens_get_acs(
table,
geo = NULL,
...,
year = 2019,
survey = c("acs5", "acs1"),
check_geo = FALSE,
drop_total = FALSE,
show_call = FALSE
)
cens_get_raw(
table,
geo = NULL,
...,
year = 2010,
api = NULL,
check_geo = FALSE,
show_call = TRUE
)
table |
The table to download, either as a character vector or a table
object as produced by |
geo |
The geographic level to return. One of the machine-readable or
human-readable names listed in the "Details" section of |
... |
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 |
sumfile |
For decennial data, the summary file to use. SF2 contains more detailed race and household info. |
pop_group |
For decennial data using summary file SF2, the population group to filter to. See https://www2.census.gov/programs-surveys/decennial/2010/technical-documentation/complete-tech-docs/summary-file/sf2.pdf#page=347. |
check_geo |
If |
drop_total |
Whether to filter out variables which are totals across another variable. Recommended only after inspection of the underlying table. |
show_call |
Whether to show the actual call to the Census API. May be useful for debugging. |
year |
For ACS data, the survey year to get data for. |
survey |
For ACS data, whether to use the one-year or
five-year survey (the default). Make sure to check availability using
|
api |
A Census API programmatic name such as |
A tibble of census data in tidy format, with columns
GEOID
, NAME
, variable
(containing the Census variable code),
value
or estimate
in the case of ACS tables,
and additional factor columns specific to the table.
cens_get_dec()
: Get decennial census data.
cens_get_acs()
: Get American Community Survey (ACS) data.
cens_get_raw()
: Get raw data from another Census Bureau API. Output will
be minimally tidied but will likely require further manipulation.
## Not run:
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")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.