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.
In terms of a reproducible example: ProbeSet.ID.F ProbeSet.ID Feature.ID Gene.Symbol X0030V120810.4 X0143V120110.4 X0258V111710.4 X0283V111710.4 X0430V120710.4 X0472V111610.4 X0520V111610.4 X0546V113010.4 X0578V111810.4 X0624V111810.4 7896741_479302 7896741 479302 OR4F17 20 14 5 4 43 85 12 14 7 5 7896741_226901 7896741 226901 OR4F17 15 73 31 14 32 28 10 42 11 28 7896741_2337 7896741 2337 OR4F17 168 126 111 120 119 84 149 76 347 88 7896741_289201 7896742 289201 OR4F18 54 64 11 6 59 66 10 50 51 27 7896741_240730 7896742 240730 OR4F18 38 158 95 38 59 131 114 100 102 40 7896741_776611 7896743 776611 OR4F19 6 27 7 7 16 105 35 17 19 23 ...becomes three panels of a plot, containing the lines: Plot 1: 7896741_479302 7896741 479302 OR4F17 20 14 5 4 43 85 12 14 7 5 7896741_226901 7896741 226901 OR4F17 15 73 31 14 32 28 10 42 11 28 7896741_2337 7896741 2337 OR4F17 168 126 111 120 119 84 149 76 347 88 Plot2: 7896741_289201 7896742 289201 OR4F18 54 64 11 6 59 66 10 50 51 27 7896741_240730 7896742 240730 OR4F18 38 158 95 38 59 131 114 100 102 40 Plot 3: 7896741_776611 7896743 776611 OR4F19 6 27 7 7 16 105 35 17 19 23 and so on... Any ideas much appreciated. -- View this message in context: http://r.789695.n4.nabble.com/Group-rows-by-common-ID-and-plot-tp3321955p3323465.html Sent from the R help mailing list archive at Nabble.com.