Re: [R] select row based on highest value

2010-02-23 Thread LCOG1
Ah perfect thank you. From: jholtman [via R] [mailto:ml-node+1566613-1138252725-103...@n4.nabble.com] Sent: Tuesday, February 23, 2010 2:00 PM To: ROLL Josh F Subject: Re: select row based on highest value Is this better: > sapply(split(v, v$Prop), function(x) x

Re: [R] select row based on highest value

2010-02-23 Thread jim holtman
Is this better: > sapply(split(v, v$Prop), function(x) x$TAZ[which.max(x$area)]) p754921 p75506 p75508 37 282 46 > Take a look at what you were doing. The result of the 'tapply' is to split v$area in to smaller groups based on v$Prop, so the 'x' parameter is not going to be the

[R] select row based on highest value

2010-02-23 Thread LCOG1
Please consider the following #Data to use Props<-c("p754921","p754921" ,"p754921","p75506" ,"p75506" ,"p75506","p75506","p75508","p75508","p75508","p75508","p75508") TAZ<-c(38,37,37,171,171,282,171,46,46,169,169,169) Area<-c(109828.04, 128134.71, 46469.57, 37160.21, 40080.50,344679.66