powered by
Find the nth maximum value
nth_max(x, n = 1)
the value of the nth most maximum value in a vector
a vector of numeric values
which max to return
x <- c(1:20, 20:1) nth_max(x, n = 1) #20 nth_max(x, n = 2) #19
Run the code above in your browser using DataLab