group_race: : Classify given race as one of the conventional medical...

Description Usage Arguments Value Examples

Description

Convert a column in a data.table containing nuanced, specific races into the aggregated set: white, black, hispanic, other that is more commonly found in US medical literature.

Usage

1
group_race(data, race_col = "race", inplace = FALSE)

Arguments

data

a data.table with the column containing races (data.table)

race_col

a string specifying the name of column containing race info, "race" by default (character)

inplace

if TRUE old race column is replaced with aggregated race infor, if FALSE (default), a new column called "race_group" is added (logical)

Value

data.table with the a new race_group column containing aggregated race / old column replaced with this column if inplace = TRUE (data.table)

Examples

1
2
3
4
5
mod_dem <- group_race(dem, inplace = TRUE)
unique(mod_dem[, race, ], by = "race")

grp_dem <- group_race(dem)
unique(grp_dem[, .(race, race_group), ], by = "race")

ClaraMarquardt/ehR documentation built on May 6, 2019, 12:02 p.m.