Row-wise maxima
row_max(.data, which = NULL, ...) # S3 method for matrix row_max(.data, which = NULL, ...) # S3 method for data.frame row_max(.data, which = NULL, ...)
.data | A two-dimensional data structure. |
---|---|
which | If not |
... | Arguments passed on to
|
For data frames, if the input columns have different modes, all of them will be promoted on-the-fly to the highest one in the R hierarchy.
String comparison is done in C++, which can vary from what R does.
df <- data.frame(FALSE, TRUE, NA_character_) # all columns promoted to character (on-the-fly) row_max(df)#> [1] "TRUE"row_max(df, na_action = "pass")#> [1] NA# no promotion row_max(df, cols = 1:2)#> [1] TRUErow_max(df, cols = 1:2, which = "first")#> [1] 2