Lowest k values of list
On Sep 5, 2008, at 11:26 AM, Markus M?hlbacher 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.
Might depend on how you define "high" and "low". Consider these experiments: > z <- list(1,4,"5",6,,2,3) > head(sort(unlist(z)),n=2) [1] "1" "2" > tail(sort(unlist(z)),n=2) [1] "5" "6" > z <- list(1,2,3,4,"5",6,"a") > tail(sort(unlist(z)),n=2) [1] "6" "a" > head(sort(unlist(z)),n=2) [1] "1" "2"
David Winsemius