[R] Largest N Values Efficiently?
jim holtman
jholtman at gmail.com
Mon Nov 12 04:46:21 CET 2007
Try:
sort(x, partial=n)[1:n]
On Nov 11, 2007 6:43 PM, David Katz <david at davidkatzconsulting.com> 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 at 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?
More information about the R-help
mailing list