conv_hispanic: Add or update Hispanic ethnicity column

conv_hispanicR Documentation

Add or update Hispanic ethnicity column

Description

Add or update Hispanic ethnicity column

Usage

conv_hispanic(df)

conv_hispanic_helper(df)

Arguments

df

a data.table to add to or update with an ethnicity_hispanic column

Details

ethnicity_hispanic was not added until the 2008 NSQIP PUF when race was revised to race_new. Data regarding hispanic ethnicity was hard coded directly into the old race variable (such as "Hispanic, White"). In order to marry early and later datasets, this information must be extracted from race and a new ethnicity_hispanic column created.

If the data provided already has a ethnicity_hispanic column present, this column is simply converted into a logical vector.

Value

a data table

Functions

  • conv_hispanic_helper: A helper function for updating the ethnicity_hispanic column

Examples

x <- data.table::data.table(
race = c("Hispanic, White", "White, Not of Hispanic Origin","Hispanic, Black",
"Black, Not of Hispanic Origin", "Hispanic, Color Unknown", "White", "Black or African American",
"American Indian or Alaska Native", "Asian", "Native Hawaiian or Pacific Islander",
"Asian or Pacific Islander", NA),
ethnicity_hispanic = c(NA, NA, NA, NA, NA, "Yes", "No", "Yes", "No", NA, NA, "Yes")
)

nsqipr:::conv_hispanic(x)
x


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