Package 'epiextractr'

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

Help Index


Retrieve metadata from CPS extract

Description

Retrieve metadata from CPS extract

Usage

cps_version(x)

cps_citation(x)

assert_cps_version(x, version)

Arguments

x

EPI CPS extract generated from load_cps() functions

version

String version number

Value

cps_version and cps_citation return version or citation strings.

assert_cps_version returns an error when the provided version is incorrect.

Examples

## 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 EPI CPS extracts data

Description

Download the EPI CPS extracts to your local machine

Usage

download_cps(sample, extracts_dir = NULL, overwrite = FALSE)

Arguments

sample

CPS sample ("org", "basic", "may")

extracts_dir

directory where EPI extracts should be placed

overwrite

when TRUE, overwrite data

Value

downloaded files

Examples

## Not run: 
download_cps(sample = "march", extracts_dir = "/data/cps")

## End(Not run)

Load a selection of EPI CPS extracts

Description

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.

Usage

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)

Arguments

.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

Details

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.

Value

A tibble of CPS microdata

Functions

  • 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

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)