conv_race: Convert race to factor

conv_raceR Documentation

Convert race to factor

Description

Convert race to factor

Usage

conv_race(vec, pacific = "asian")

Arguments

vec

a character vector of races to be converted to a factor

pacific

whether to consider "Asian or Pacific Islander" as part of the "Native Hawaiian or Pacific islander" level or part of the "Asian" level.

Details

2005-2007 NSQIP PUFs included a race called "Asian or Pacific islander". Later PUFs split these into "Asian" and "Native Hawaiian or Pacific islander". In order to combine PUFs, a decision must be made as to which group to assign "Asian or Pacific islander" to. To assign them to "Asian", pacific should be set to "asian". To assign them to "Native Hawaiian or Pacific islander", pacific should be set to "hawaiian".

Value

a factor vector

Examples

x <- c("White","Black or African American","Asian or Pacific Islander")
nsqipr:::conv_race(x)
x

x <- c("White","Black or African American","Asian or Pacific Islander")
nsqipr:::conv_race(x, pacific = "hawaiian")
x

dylanrussellmd/nsqipr documentation built on Oct. 13, 2023, 11:01 a.m.