[R] <no subject>

Jacques VESLOT jacques.veslot at cirad.fr
Thu Dec 15 06:31:31 CET 2005


try with merge() :

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

newtable    <- merge(table1, table2, by="CGID")

matplot(merge(table1, table2, by="CGID")[,2:3])

or reshape() it :

newtable2   <- reshape(newtable,
                idvar="CGID",
                varying=list(names(newtable)[2:3]),
                v.names="diff",
                direction="long")

plot(diff ~ CGID, newtable2)        # if a good number of points
stripplot(diff ~ CGID, newtable2)   # if only two per CGID level


Marco Blanchette a écrit :

>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.
>
>Many tx
>
>Marco Blanchette, Ph.D.
>
>mblanche at berkeley.edu
>
>Donald C. Rio's lab
>Department of Molecular and Cell Biology
>16 Barker Hall
>University of California
>Berkeley, CA 94720-3204
>
>Tel: (510) 642-1084
>Cell: (510) 847-0996
>Fax: (510) 642-6062
>
>______________________________________________
>R-help at 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
>
>  
>




More information about the R-help mailing list