nth_max {eeptools} | R Documentation |
Find the nth maximum value
Description
Find the nth maximum value
Usage
nth_max(x, n = 1)
Arguments
x |
a vector of numeric values |
n |
which max to return |
Value
the value of the nth most maximum value in a vector
Note
If n
is smaller/larger than 0
/length(unique(x))
the error ‘index outside bounds’ is thrown.
Examples
x <- c(1:20, 20:1)
nth_max(x, n = 1) #20
nth_max(x, n = 2) #19
[Package eeptools version 1.2.5 Index]