[R] how to "singlify" entries

From: zhihua li <lzhtom_at_hotmail.com>
Date: Mon 30 May 2005 - 19:15:32 EST


hi netters

I have a rather simple question. I have a data frame with two variables X and Y, both of which are factors. X has 100 levels while Y has 10 levels only. The data frame has 100 rows in all, so for X the values are unique, and Y has many replicate values. Now I wanna reduce the data frame into 10 rows only, according to the 10 levels of Y. I don't care which value of X is in the same row with Y in the final data frame, as long as it is in agreement with the original data frame.

I think this task can be carried out with some function like aggregate. but I failed in figuring it out. Could anybody give me a hint?

Thanks a lot!



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 Received on Mon May 30 19:22:10 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:15 EST