
Last chance! 50% off unlimited learning
Sale ends in
Small(x, k = 5, unique = FALSE, na.rm = FALSE)
Large(x, k = 5, unique = FALSE, na.rm = FALSE)
numeric
vectork = 5
. If k > length(x), all values will be returned.TRUE
, a list with the k extreme values and their frequencies is returned. Default is FALSE
(as unique is a rather expensive function).FALSE
.unique
is set to FALSE
or a list, containing the k most extreme values and their respective frequency.sort(..., partial)
, which isn't the fastest solution, but a fairly fast one.max
, max
, HighLow
, sort
, rank
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