Skip to content
Back to formatted view

Raw Message

Message-ID: <440457.84670.qm@web38103.mail.mud.yahoo.com>
Date: 2008-09-08T02:24:36Z
From: Srinivas Iyyer
Subject: extracting max row from data matrix

dear group, 
i have a data matrix with some replicate items with different values. I want to extract the row with max value. 

for example:
> x
   fruit weight
1  apple    1.3
2  apple    1.5
3  apple    1.6
4 orange    1.4
5 orange    1.6


x is a data frame. 
I want to extract unique items from fruits that has max weight. 

that is:

3  apple    1.6
5 orange    1.6

I want to be able to use apply functions. Could some one lend some help please. 

Thanks
srini