get_estimates | R Documentation |
get_estimates()
requests data from the Population Estimates API for years 2019 and earlier; however the Population Estimates are no longer supported on the API as of 2020. For recent years, get_estimates()
reads a flat file from the Census website and parses it. This means that arguments and output for 2020 and later datasets may differ slightly from datasets acquired for 2019 and earlier.
get_estimates(
geography = c("us", "region", "division", "state", "county", "county subdivision",
"place/balance (or part)", "place", "consolidated city", "place (or part)",
"metropolitan statistical area/micropolitan statistical area", "cbsa",
"metropolitan division", "combined statistical area"),
product = NULL,
variables = NULL,
breakdown = NULL,
breakdown_labels = FALSE,
year = 2022,
state = NULL,
county = NULL,
time_series = FALSE,
output = "tidy",
geometry = FALSE,
keep_geo_vars = FALSE,
shift_geo = FALSE,
key = NULL,
show_call = FALSE,
...
)
geography |
The geography of your data. Available geographies for the most recent data vintage are listed
here. |
product |
The data product (optional). For 2020 and later, the only supported product is |
variables |
A character string or vector of character strings of requested variables. For years 2020 and later, use |
breakdown |
The population breakdown used when |
breakdown_labels |
Whether or not to label breakdown elements returned when
Not yet supported for 2020 and later. |
year |
The data year (defaults to 2022). It is recommended to use the most recent vintage
available for a given decennial series (so, year = 2019 for the 2010s, and year = 2022 for the 2020s)
and use |
state |
The state for which you are requesting data. State names, postal codes, and FIPS codes are accepted. Defaults to NULL. |
county |
The county for which you are requesting data. County names and FIPS codes are accepted. Must be combined with a value supplied to 'state'. Defaults to NULL. |
time_series |
If |
output |
One of "tidy" (the default) in which each row represents an enumeration unit-variable combination, or "wide" in which each row represents an enumeration unit and the variables are in the columns. |
geometry |
if FALSE (the default), return a regular tibble of ACS data. if TRUE, uses the tigris package to return an sf tibble with simple feature geometry in the 'geometry' column. |
keep_geo_vars |
if TRUE, keeps all the variables from the Census shapefile obtained by tigris. Defaults to FALSE. |
shift_geo |
(deprecated) if TRUE, returns geometry with Alaska and Hawaii shifted for thematic
mapping of the entire US. As of May 2021, we recommend using |
key |
Your Census API key.
Obtain one at https://api.census.gov/data/key_signup.html. Can be stored
in your .Renviron with |
show_call |
if TRUE, display call made to Census API. This can be very useful in debugging and determining if error messages returned are due to tidycensus or the Census API. Copy to the API call into a browser and see what is returned by the API directly. Defaults to FALSE. |
... |
other keyword arguments |
As of April 2022, variables available for 2020 and later datasets are as follows: ESTIMATESBASE, POPESTIMATE, NPOPCHG, BIRTHS, DEATHS, NATURALCHG, INTERNATIONALMIG, DOMESTICMIG, NETMIG, RESIDUAL, GQESTIMATESBASE, GQESTIMATES, RBIRTH, RDEATH, RNATURALCHG, RINTERNATIONALMIG, RDOMESTICMIG, and RNETMIG.
A tibble, or sf tibble, of population estimates data
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.