make_race_eth_var | R Documentation |
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.
make_race_eth_var(df, dataset, name = "race_eth")
df |
Data frame to add race/ethnicity variable to. |
dataset |
Dataset corresponding to |
name |
Name to give race/ethnicity variable. Defaults to
|
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
.
A data frame.
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.