getMaxIndexOfRows {BBmisc} | R Documentation |
getMaxIndexOfRows
returns the index of the maximal element of each row.
getMinIndexOfRows
returns the index of the minimal element of each row.
getMaxIndexOfCols
returns the index of the maximal element of each col.
getMinIndexOfCols
returns the index of the minimal element of each col.
If a corresponding vector (row or col) is empty, possibly after NA removal, -1 is returned
as index.
getMaxIndexOfRows(x, ties.method = "random", na.rm = FALSE) getMinIndexOfRows(x, ties.method = "random", na.rm = FALSE) getMaxIndexOfCols(x, ties.method = "random", na.rm = FALSE) getMinIndexOfCols(x, ties.method = "random", na.rm = FALSE)
x |
[ |
ties.method |
[ |
na.rm |
[ |
[integer(n)
].
x = matrix(runif(5 * 3), ncol=3)
print(x)
## [,1] [,2] [,3]
## [1,] 0.46134 0.06027 0.93681
## [2,] 0.09771 0.55184 0.29877
## [3,] 0.38113 0.17143 0.26932
## [4,] 0.40259 0.22841 0.06938
## [5,] 0.42387 0.89181 0.91004
print(getMaxIndexOfRows(x))
## [1] 3 2 1 1 3
print(getMinIndexOfRows(x))
## [1] 2 1 2 3 1