Re: [R] Histogram for each ID value

2011-10-17 Thread Philipp Pagel
> where the first column is the chromosome location and the second column is > some value. What I'd like to do is have a histogram created for each chr > location (i.e. a separate histogram for chr1, chr2, chr3, chr7, chr9, and > chr22). I am just having a hard time getting everything to work out

Re: [R] Histogram for each ID value

2011-10-17 Thread R. Michael Weylandt
Like others have suggested, I think ggplot2 is probably the best way to go about this, but if you'd rather use base graphics (and you never indicated how you felt about ggplot2), you could do something like this with tapply: fcts <- letters[sample(9,1500,T)] vals <- rnorm(1500) df <- data.frame(ca

Re: [R] Histogram for each ID value

2011-10-17 Thread Ben Bolker
Paul Hiemstra knmi.nl> writes: > > Hi, > > When using ggplot, take a look at facet_wrap and geom_histogram. > > regards, More specifically, try something along the lines of d <- data.frame(f=factor(paste("chr",rep(c(1,2,3,7,9,22),each=50),sep="")), v=runif(300)) library(ggplot2) ggplo

Re: [R] Histogram for each ID value

2011-10-17 Thread Paul Hiemstra
Hi, When using ggplot, take a look at facet_wrap and geom_histogram. regards, Paul On 10/17/2011 12:14 PM, Sarah Goslee wrote: > Hi, > > On Mon, Oct 17, 2011 at 8:07 AM, a217 wrote: >> I have a dataframe in the general format: >> >> chr1 0.5 >> chr1 0 >> chr1 0.75 >> chr2 0 >> chr2 0 >> chr3 1

Re: [R] Histogram for each ID value

2011-10-17 Thread Sarah Goslee
Hi, On Mon, Oct 17, 2011 at 8:07 AM, a217 wrote: > I have a dataframe in the general format: > > chr1 0.5 > chr1 0 > chr1 0.75 > chr2 0 > chr2 0 > chr3 1 > chr3 1 > chr3 0.5 > chr7 0.75 > chr9 1 > chr9 1 > chr22 0.5 > chr22 0.5 Using dput to give us some reproducible data would be even better.

[R] Histogram for each ID value

2011-10-17 Thread a217
I have a dataframe in the general format: chr1 0.5 chr1 0 chr1 0.75 chr2 0 chr2 0 chr3 1 chr3 1 chr3 0.5 chr7 0.75 chr9 1 chr9 1 chr22 0.5 chr22 0.5 where the first column is the chromosome location and the second column is some value. What I'd like to do is have a histogram created for each chr