[R] how to "singlify" entries

zhihua li lzhtom at hotmail.com
Mon May 30 11:15:32 CEST 2005


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!




More information about the R-help mailing list