Title: | Load CPS Microdata into R Using the 'Census Bureau Data' API |
---|---|
Description: | Load Current Population Survey (CPS) microdata into R using the 'Census Bureau Data' API (<https://www.census.gov/data/developers/data-sets.html>), including basic monthly CPS and CPS ASEC microdata. |
Authors: | Matt Saenz [aut, cre] |
Maintainer: | Matt Saenz <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.0 |
Built: | 2025-02-12 05:26:06 UTC |
Source: | https://github.com/matt-saenz/cpsr |
get_asec()
loads
CPS ASEC
microdata using the Census API.
get_asec( year, vars, key = get_key(), show_url = FALSE, tibble = TRUE, convert = TRUE )
get_asec( year, vars, key = get_key(), show_url = FALSE, tibble = TRUE, convert = TRUE )
year |
Year of data to retrieve. Years 1992 and on are currently supported. |
vars |
Character vector of variables to retrieve, where each vector element corresponds to the name of a single variable. Variable names can be given in uppercase or lowercase but are always made lowercase in the returned data. |
key |
Census API key.
Defaults to environment variable |
show_url |
If |
tibble |
If |
convert |
If |
A tibble or base data frame.
## Not run: asec21 <- get_asec(2021, vars = c("marsupwt", "spm_poor")) ## End(Not run)
## Not run: asec21 <- get_asec(2021, vars = c("marsupwt", "spm_poor")) ## End(Not run)
get_basic()
loads
basic monthly CPS
microdata using the Census API.
get_basic( year, month, vars, key = get_key(), show_url = FALSE, tibble = TRUE, convert = TRUE )
get_basic( year, month, vars, key = get_key(), show_url = FALSE, tibble = TRUE, convert = TRUE )
year |
Year of data to retrieve. Years 1989 and on are currently supported. |
month |
Month of data to retrieve (specified as a number). |
vars |
Character vector of variables to retrieve, where each vector element corresponds to the name of a single variable. Variable names can be given in uppercase or lowercase but are always made lowercase in the returned data. |
key |
Census API key.
Defaults to environment variable |
show_url |
If |
tibble |
If |
convert |
If |
A tibble or base data frame.
## Not run: sep21 <- get_basic( year = 2021, month = 9, vars = c("pwcmpwgt", "prpertyp", "prtage", "pemlr") ) ## End(Not run)
## Not run: sep21 <- get_basic( year = 2021, month = 9, vars = c("pwcmpwgt", "prpertyp", "prtage", "pemlr") ) ## End(Not run)