nth | R Documentation |
nth
get the value from a vector with its position,
while maxth
and minth
get the nth highest or lowest value
from the vector.
nth(v, n = 1)
maxth(v, n = 1)
minth(v, n = 1)
v |
A vector |
n |
For |
A single value.
https://stackoverflow.com/questions/2453326/fastest-way-to-find-second-third-highest-lowest-value-in-vector-or-column/66367996#66367996
x = 1:10
nth(x, 1)
nth(x, 5)
nth(x, -2)
y = c(10,3,4,5,2,1,6,9,7,8)
maxth(y,3)
minth(y,3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.