conv_hispanic | R Documentation |
Add or update Hispanic ethnicity column
conv_hispanic(df)
conv_hispanic_helper(df)
df |
a data.table to add to or update with an |
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.
a data table
conv_hispanic_helper
: A helper function for updating the ethnicity_hispanic
column
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.