Search notes:

R function: which.max

which.max returns the position of the element with the maximal value in a vector.
The value of that element can be found with max(…).
n <- c (31, 47, 18, 9, 25, 19, 62, 32)

pos_max <- which.max(n)
print(pos_max)
# [1] 7

n[pos_max]
# [1] 62
Github repository about-r, path: /functions/which/max.R

See also

which.min, which
Index to (some) R functions

Index