selecting other row element after aggregate in R [duplicate]
问题 This question already has answers here : Only keep min value for each factor level (9 answers) Subset data based on Minimum Value (2 answers) Closed last year . I would like to select the youngest person in each group and categorize it by gender so this is my initial data data1 ID Age Gender Group 1 A01 25 m a 2 A02 35 f b 3 B03 45 m b 4 C99 50 m b 5 F05 60 f a 6 X05 65 f a I would like to have this Gender Group Age ID m a 25 A01 f a 60 F05 m b 45 B03 f b 35 A02 So I tried with aggraeate