Lowest k values of list
Do you mean a vector? If so, head/tail will work for you:
x <- runif(10) x
[1] 0.26550866 0.37212390 0.57285336 0.90820779 0.20168193 0.89838968 0.94467527 [8] 0.66079779 0.62911404 0.06178627
# lowest 5 head(sort(x), 5)
[1] 0.06178627 0.20168193 0.26550866 0.37212390 0.57285336
# highest 5 tail(sort(x), 5)
[1] 0.6291140 0.6607978 0.8983897 0.9082078 0.9446753
On Fri, Sep 5, 2008 at 11:26 AM, Markus M?hlbacher <muehliman at yahoo.com> wrote:
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 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 that you are trying to solve?