Small(x, k = 1, unique = FALSE, na.rm = FALSE)
Large(x, k = 1, unique = FALSE, na.rm = FALSE)
numeric
vectork = 1
. If k > length(x), all values will be returned.sort(..., partial)
, which isn't the fastest solution, but a fairly fast one.max
, max
, HighLow
, sort
x <- sample(1:10, 1000, rep=TRUE)
Large(x, 3)
Large(x, k=3, unique=TRUE)
# works fine up to x ~ 1e6
x <- runif(1000000)
Small(x, 3, unique=TRUE)
Small(x, 3, unique=FALSE)
Run the code above in your browser using DataLab