Re: [R] how to "singlify" entries

From: Charles Plessy <charles-r-nospam_at_plessy.org>
Date: Mon 30 May 2005 - 22:56:57 EST

On Mon, May 30, 2005 at 09:15:32AM +0000, zhihua li wrote :
> 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.

Dear list,

I am a new subscriber, using R to analyse genomics data. I have a similar question, maybe even identical, but I am not sure...

>From a data frame with two factors and one value, I would like to obtain a data
frame with one factor and one value per level in the removed factor.

For instance:

F1 F2 V


A       X       3
A       Y       6
B       X       5
C       X       9
C       Y       3

Would become:

F1 VX VY


A       3       6
B       5       0
C       9       3

I am sure I have seen a tool to do this some time ago, but I do not remember its name.

Can somebody help me ?

Best regards,

-- 
Charles Plessy, Ph.D. - Genome Science Laboratory
The Institute for Physical and Chemical Research (RIKEN)
2-1 Hirosawa, Wako, Saitama 351-0198, Japan
plessy@riken.jp --  Fax: 048-462-4686  --  Tel: 048-467-9515

______________________________________________
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 23:02:46 2005

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