maxN: Determine the top max or min values

maxNR Documentation

Determine the top max or min values

Description

Determine the top maximum or minimum values in a vector.

Usage

maxN(x, N = 1)

minN(x, N = 1)

Arguments

x

A data object.

N

Character vector of the column name.

Value

The Nth max or min value (numeric).

Source

Adapted from Zachary Mayer's stackoverflow contribution: https://stackoverflow.com/questions/2453326/fastest-way-to-find-second-third-highest-lowest-value-in-vector-or-column

Examples

tempData <- c(1,4,1,7,2)
maxN(tempData, N=2)
minN(tempData, N=2)


al-obrien/farrago documentation built on April 14, 2023, 6:20 p.m.