Skip to content
Prev 82816 / 398503 Next

<no subject>

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 :