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
______________________________________________
[email protected] 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.