Hi there, > a<-data.frame(c(1,2,2,5,9,9),c("A","B","C","D","E","F")) > names(a)<-c("x1","x2") > max(table(a$x1)) [1] 2 > The above shows the max count for x1 is 2, which is correct. But we can't tell there are 2 groups that meet this criteria: 2,2 and 9,9. I then want to extract the records that has the hightest count > a[max(table(a$x1)),] x1 x2 2 2 B This is not working, since it is equvalent to a[2,] What I want is x1 x2 2 2 B 3 2 C 5 9 E 5 9 F
I think this should be very easy, but I'm a beginner :-) Thanks YJM ______________________________________________ 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.