make_race_eth_var: Make a race/ethnicity variable

View source: R/make_vars.R

make_race_eth_varR Documentation

Make a race/ethnicity variable

Description

make_race_eth_var() creates a 5-level race/ethnicity variable in ACS, CPS ASEC, or basic monthly CPS microdata. Levels include white only, not Latino; Black only, not Latino; Latino (any race); Asian only, not Latino; and another race or multi-racial, not Latino.

Usage

make_race_eth_var(df, dataset, name = "race_eth")

Arguments

df

Data frame to add race/ethnicity variable to.

dataset

Dataset corresponding to df. One of "acs", "cps_asec", or "cps_basic".

name

Name to give race/ethnicity variable. Defaults to "race_eth".

Details

For the ACS, years 2005 to present are supported and required variables are rac1p and hisp. For the CPS ASEC, survey years 2003 to present are supported and required variables are prdtrace and pehspnon. For the basic monthly CPS, years 2003 to present are supported and required variables are ptdtrace and pehspnon.

Value

A data frame.

Warning

This function is designed to work with original, Census-based ACS or CPS microdata. (As opposed to Census microdata that have been processed by, for example, IPUMS.) Therefore, prior to using this function you should ensure that your data are behaving according to their official data dictionary.


CenterOnBudget/Rcbpp documentation built on Jan. 6, 2025, 9:32 p.m.