x = c(2, 3, 1, 3, 5, 1, 1)
which_min(x, ties_method = "first")
which_min(x, ties_method = "last")
which_min(x, ties_method = "random")
which_max(x)
which_max(integer(0))
which_max(NA)
which_max(c(NA, 1))
Run the code above in your browser using DataLab