Title: | Tools to use Economic Policy Institute Microdata Extracts |
---|---|
Description: | Tools to download and load the EPI microdata extracts from microdata.epi.org. |
Authors: | Ben Zipperer [aut, cre], Economic Policy Institute [cph, fnd] |
Maintainer: | Ben Zipperer <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.9.1 |
Built: | 2024-10-21 05:34:07 UTC |
Source: | https://github.com/economic/epiextractr |
Retrieve metadata from CPS extract
cps_version(x) cps_citation(x) assert_cps_version(x, version)
cps_version(x) cps_citation(x) assert_cps_version(x, version)
x |
EPI CPS extract generated from |
version |
String version number |
cps_version
and cps_citation
return version or citation strings.
assert_cps_version
returns an error when the provided version is incorrect.
## Not run: cps_org <- load_org(2018:2020) cps_citation(cps_org) cps_version(cps_org) assert_cps_version(cps_org, "1.0.11") ## End(Not run)
## Not run: cps_org <- load_org(2018:2020) cps_citation(cps_org) cps_version(cps_org) assert_cps_version(cps_org, "1.0.11") ## End(Not run)
Download the EPI CPS extracts to your local machine
download_cps(sample, extracts_dir = NULL, overwrite = FALSE)
download_cps(sample, extracts_dir = NULL, overwrite = FALSE)
sample |
CPS sample ("org", "basic", "may") |
extracts_dir |
directory where EPI extracts should be placed |
overwrite |
when TRUE, overwrite data |
downloaded files
## Not run: download_cps(sample = "march", extracts_dir = "/data/cps") ## End(Not run)
## Not run: download_cps(sample = "march", extracts_dir = "/data/cps") ## End(Not run)
Select years and variables from the EPI CPS microdata extracts. These data
must first be downloaded using download_cps()
or from
https://microdata.epi.org.
load_cps(.sample, .years, ..., .extracts_dir = NULL, .version_check = TRUE) load_basic(.years, ..., .extracts_dir = NULL, .version_check = TRUE) load_may(.years, ..., .extracts_dir = NULL, .version_check = TRUE) load_org(.years, ..., .extracts_dir = NULL, .version_check = TRUE) load_org_sample(.years, ..., .extracts_dir = NULL, .version_check = TRUE)
load_cps(.sample, .years, ..., .extracts_dir = NULL, .version_check = TRUE) load_basic(.years, ..., .extracts_dir = NULL, .version_check = TRUE) load_may(.years, ..., .extracts_dir = NULL, .version_check = TRUE) load_org(.years, ..., .extracts_dir = NULL, .version_check = TRUE) load_org_sample(.years, ..., .extracts_dir = NULL, .version_check = TRUE)
.sample |
CPS sample ("org", "basic", "march", "may") |
.years |
years of CPS data (integers) |
... |
tidy selection of variables to keep |
.extracts_dir |
directory where EPI extracts are |
.version_check |
when TRUE, confirm data are same version |
All columns are selected if ...
is missing.
.extracts_dir
is required, but if NULL it will look for the environment variables
EPIEXTRACTS_CPSBASIC_DIR EPIEXTRACTS_CPSORG_DIR EPIEXTRACTS_CPSMAY_DIR
which could be set in your .Renviron, for example.
A tibble of CPS microdata
load_cps()
: base function group
load_basic()
: Load CPS Basic Monthly files
load_may()
: Load CPS May files
load_org()
: Load CPS ORG files
load_org_sample()
: Load a demonstration sample of CPS ORG files; only useful for examples
## Not run: # Load all of the 2019-2020 CPS Basic columns load_basic(2019:2020) # Load a selection of 2010-2019 CPS ORG columns: load_org(2010:2019, year, month, orgwgt, female, wage) # These are equivalent: load_org(2019:2020) load_cps("org", 2019:2020) ## End(Not run)
## Not run: # Load all of the 2019-2020 CPS Basic columns load_basic(2019:2020) # Load a selection of 2010-2019 CPS ORG columns: load_org(2010:2019, year, month, orgwgt, female, wage) # These are equivalent: load_org(2019:2020) load_cps("org", 2019:2020) ## End(Not run)