Dear R users, I have some trouble with the aggregate function. Here are my data
> daf S_id AF_Class count... R_gc_percent S_length 5 8264497 1 30 0.48 35678 6 8264497 3 7 0.48 35678 8 8264554 1 31 0.51 38894 9 8264554 2 11 0.51 38894 10 8264554 3 1 0.51 38894 for a given S_id, I would like to select the line corresponding to the max count. To perform this, I used: > aggregate(daf,list(daf$S_id),max) Group.1 S_id AF_Class count... R_gc_percent S_length 1 8264497 8264497 3 30 0.48 35678 2 8264554 8264554 3 31 0.51 38894 which is ok for the count. But I realized that max function is also applied to AF_class (should be 1 and 1 instead of 3 and 3), so it seems that aggregate is not the appropriate function for that I want to do. Is there any other function I could use instead? Best whishes, Stéphane. -- ========================================================== Stephane CRUVEILLER Ph. D. Genoscope - Centre National de Sequencage Atelier de Genomique Comparative 2, Rue Gaston Cremieux CP 5706 91057 Evry Cedex - France Phone: +33 (0)1 60 87 84 58 Fax: +33 (0)1 60 87 25 14 EMails: [EMAIL PROTECTED] ,[EMAIL PROTECTED] ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html