Skip to content
Back to formatted view

Raw Message

Message-ID: <4D51A39D-3F01-4F82-8262-39855EA88981@comcast.net>
Date: 2008-09-05T16:03:40Z
From: David Winsemius
Subject: Lowest k values of list
In-Reply-To: <429676.87607.qm@web55102.mail.re4.yahoo.com>

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