In addition to the other responses, you may want to look at the 'partial' 
argument to sort.  For large vectors it may speed things up to not sort 
everything if all you care about is the top and bottom few.

Try:

> tmp <- rnorm(100)
> plot( sort(tmp, partial=c(1,2,99,100) ) )

Hope this helps,

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111



> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Markus Mühlbacher
> Sent: Friday, September 05, 2008 9:26 AM
> To: r-help@r-project.org
> Subject: [R] Lowest k values of list
>
> Hi @ all,
>
> how do I get the largest or lowest k values of list? It must
> similar to the min() / max() function, but I just don't get it.
>
> Best wishes,
> Markus
>
>
>
>
> ______________________________________________
> 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.
>

______________________________________________
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.

Reply via email to