dplyr-获取行最大值与行最大值对应的索引列
2023-01-10 本文已影响0人
倪桦
Get the value of the max within row
data %>% mutate(row.max_val = do.call(pmax, (.)))
Get the argmax within row
data %>% mutate(row.argmax = names(.)[max.col(.)])
data %>% mutate(row.max_val = do.call(pmax, (.)))
data %>% mutate(row.argmax = names(.)[max.col(.)])