decode_race: Convert Race Codes to a Single Label

Description Usage Arguments Details Value Author(s) See Also

View source: R/panthr.r

Description

decode_race formats the RACE_CODES field by evaluating a scalar or vector of values with race codes and missing values and converting them to a single category. For example, while B will convert to Black or African American, BZ will convert to Two or More Races. Missing values are converted to Not Reported.

Usage

1

Arguments

code

A scalar or vector of length n and class character containing race codes, e.g. W, B, Z, I, P, or any permutation containing more than one code, e.g. ZI, WBP, etc.

Details

Output may be made categorical using function factor or as.factor. This function also allows for easily tallying counts using, e.g., function table.

Values containing race codes other than W, B, Z, I, or P are coerced to NA (missing) rather than converted to Not Reported. In these instances, a warning message is thrown. In instances where ethnicity codes are detected, evaluation halts and an error message is thrown.

Value

A scalar or vector of values of length n and class character converted into a single label describing the race code. NULL values are converted into the character string: Not Reported.

Author(s)

Jamison R. Crawford, Institutional Research Associate, Georgia State University

See Also

grepl, table, paste, gsub


jamisoncrawford/panthr documentation built on March 9, 2020, 6:18 p.m.