Re: [R] how to "singlify" entries

From: Petr Pikal <>
Date: Mon 30 May 2005 - 19:48:23 EST


On 30 May 2005 at 9:15, zhihua li wrote:

> hi netters
> I have a rather simple question. I have a data frame with two

Well, I do not understand you simple question fully. You have something like that

dat<-data.frame(X=1:100, Y=sample(1:10,10))


> 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.

Do you want to choose only some rows from your data frame to get unique Y and any corresponding X?


Or do you want something different?


> 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!
> ______________________________________________
> mailing list
> PLEASE do read the posting guide!

Petr Pikal mailing list PLEASE do read the posting guide! Received on Mon May 30 19:55:15 2005

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