nth_max | R Documentation |
Find the nth maximum value
nth_max(x, n = 1)
x |
a vector of numeric values |
n |
which max to return |
the value of the nth most maximum value in a vector
If n
is smaller/larger than 0
/length(unique(x))
the error ‘index outside bounds’ is thrown.
x <- c(1:20, 20:1)
nth_max(x, n = 1) #20
nth_max(x, n = 2) #19
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.