Where is is min or max value in a nmeric vector?
which_min(x, return.method = "first") which_max(x, return.method = "first")
x | [ |
---|---|
return.method | [
Default is “first”. |
Vector of integer position(s).
x = c(10, 24, 2, 2, 15, 2, 28) lapply(c("first", "last", "random", "all"), function(m) { which_min(x, return.method = m) })#> [[1]] #> [1] 3 #> #> [[2]] #> [1] 6 #> #> [[3]] #> [1] 6 #> #> [[4]] #> [1] 3 4 6 #>