At 10:47 13/09/2007, T.Lok wrote:
>Yesterday I spend the whole day struggling on how to get the maximum 
>value of "y" for every unique value of "x" from the dataframe 
>"test". In the R Book (Crawley, 2007) an example of this can be 
>found on page 121. I tried to do it this way, but I failed.
>
>In the end, I figured out how to get it working (first order, and 
>afterwards use !duplicated()). My question is: why does it not work 
>with the unique() function on p. 121 (
>i.e. test[rev(order(x)),][unique(y),]) ?

This is not a direct answer to your question but is not
tapply(y, x, max)
a simpler way to do what you want?




Michael Dewey
http://www.aghmed.fsnet.co.uk

______________________________________________
R-help@r-project.org 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.

Reply via email to