【发布时间】:2020-02-01 20:38:22
【问题描述】:
ethnicity_col_names <- c("surname", "first_name", "surname.match", "white", "black",
"hispanic", "asian", "other")
colnames(ethnicity_sample) <- ethnicity_col_names
ethnicity_sample$try <- pmax(ethnicity_sample$white, ethnicity_sample$black, ethnicity_sample$hispanic,
ethnicity_sample$asian, ethnicity_sample$other)
每个种族类别都会返回属于该种族的人的百分比可能性。当我使用 pmax 函数时,它返回最高的百分比(以数字表示)。我希望它返回具有最高匹配百分比的种族的列的名称。
【问题讨论】: