[R] Group rows by common ID and plot?

DB1984 dannybolg at gmail.com
Thu Feb 24 01:46:39 CET 2011


Suspect that this is easier than I realize, but taking some figuring out
currently. Any help would be appreciated.

I have a data frame (testhm) with many rows such as:

   ProbeSet.ID.F ProbeSet.ID Feature.ID G.S X0030V120810.14 X0143V120110.14
X0258V111710.14 X0283V111710.14 X0430V120710.14 X0472V111610.14
X0520V111610.14 X0546V113010.14 X0578V111810.14 X0624V111810.14
2 7892501_943979     7892501     943979         ---              33             
52              18              34               5              49             
81              20              90              44
3 7892501_493089     7892501     493089         ---              35              
8              13               5               5               8              
7              10               7              34

I would like to plot density or dot plots for each of the values in a row,
but to group the plots such as those rows with a common ProbeSet.ID are
plotted on the same axes.

So each individual point in rows with sharing the ProbeSet.ID "7892501"
would all be plotted on the same chart, and then for a new ProbeSet.ID a new
chart is plotted. There are generally 15-20 rows per unique ProbeSet.ID.


So far I can plot rows, but the upfront grouping is causing  a headache. 


pdf(file = "density_cd.pdf")

par(mfrow=c(4,4))

for (i in 1:nrow(testhm)){
	plot(density(testhm[i,]))
}

dev.off()


I'd be grateful for any advice on this.

Thanks.

-- 
View this message in context: http://r.789695.n4.nabble.com/Group-rows-by-common-ID-and-plot-tp3321955p3321955.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list