maxN | R Documentation |
Determine the top maximum or minimum values in a vector.
maxN(x, N = 1)
minN(x, N = 1)
x |
A data object. |
N |
Character vector of the column name. |
The Nth max or min value (numeric).
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
tempData <- c(1,4,1,7,2)
maxN(tempData, N=2)
minN(tempData, N=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.