Learn R Programming

eeptools (version 0.9.1)

nth_max: 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

Examples

Run this code
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