[R] Group rows by common ID and plot?
Mike Marchywka
marchywka at hotmail.com
Fri Feb 25 13:37:00 CET 2011
----------------------------------------
> Date: Thu, 24 Feb 2011 13:28:18 -0800
> From: dannybolg at gmail.com
> To: r-help at r-project.org
> Subject: Re: [R] Group rows by common ID and plot?
>
does this do what you want?
library("lattice")
df<-data.frame(x=1:100,y=1.0/(1:100),f=floor((1:100)/10))
str(df)
'data.frame': 100 obs. of 3 variables:
$ x: int 1 2 3 4 5 6 7 8 9 10 ...
$ y: num 1 0.5 0.333 0.25 0.2 ...
$ f: num 0 0 0 0 0 0 0 0 0 1 ...
xyplot(y~x|f,data=df)
>
> 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.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list