nth_max: Find the nth maximum value

View source: R/max_mis.R

nth_maxR 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

eeptools documentation built on June 7, 2023, 5:06 p.m.