[R] <no subject>

Sean Davis sdavis2 at mail.nih.gov
Thu Dec 15 12:32:49 CET 2005




On 12/14/05 9:14 PM, "Marco Blanchette" <mblanche at berkeley.edu> wrote:

> Dear all,
> 
> I am still fairly new to R and try to analyze large tables of data generated
> from genomic experiment. Currently, I am trying to plot pair of experiments
> coming from different file, trying to look at the behavior of individual
> feature in pair of experiment.
> 
> My problem is that I have independent list from different source and I would
> like to plot the pair of value using a common key. As in this simplified
> version:
> 
> table1 = list(CGID=c("CG_1","CG_3","CG_2", "CG_4", "CG_5"),
> diff=c(3,5,6,4,3))
> 
> table2 = list(CGID=c("CG_2","CG_3","CG_4", "CG_1", "CG_5"),
> diff=c(4,6,3,9,10))
> 
> How can link the two table trough the CGIDC column and plot the data from
> the 2 tables.

 table1 <- data.frame( CGID=c("CG_1","CG_3","CG_2", "CG_4", "CG_5"),
diff=c(3,5,6,4,3))

 table2 <- data.frame( CGID=c("CG_2","CG_3","CG_4", "CG_1", "CG_5"),
diff=c(4,6,3,9,10))

 table.merged <- merge(table1,table2,by.x=1,by.y=1)

In other words, use a data.frame here and then use merge.

Does that do it?

Sean




More information about the R-help mailing list