Displaying 1 result from an estimated 1 matches for "selection_algorithm".
2009 Jun 04
3
Fast way of finding top-n values of a long vector
If x is a (long) vector and n << length(x), what is a fast way of
finding the top-n values of x?
Some suggestions (calculating the ratio of the two top values):
library("rbenchmark")
set.seed(1); x <- runif(1e6, max=1e7); x[1] <- NA;
benchmark(
replications=20,
columns=c("test","elapsed"),
order="elapsed"
, sort = {a<-sort(x,