Try: sort(x, partial=n)[1:n]
On Nov 11, 2007 6:43 PM, David Katz <[EMAIL PROTECTED]> wrote: > > What is the most efficient alternative to x[order(x)][1:n] where > length(x)>>n? > I also need the positions of the mins/maxs perhaps by preserving names. > > Thanks for any suggestions. > -- > View this message in context: > http://www.nabble.com/Largest-N-Values-Efficiently--tf4788033.html#a13697535 > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.