[R] histograms

Gabor Grothendieck ggrothendieck at gmail.com
Fri Sep 1 21:11:00 CEST 2006


Your data seems to have come through messed up but lets
assume you have a data frame with one column per tumor.
The convert your data to stacked form and call histogram:

DF <- data.frame(T1 = 1:10, T2 = 6:15)

library(lattice)
histogram(~ values | ind, stack(DF))


On 9/1/06, Nair, Murlidharan T <mnair at iusb.edu> wrote:
> I am interested in plotting histograms for the following data
>
>
>
> Isoform
>
> Tumor_65_198
>
> Tumor_50_192
>
> Tumor_80_167
>
> Tumor_80_204
>
> Tumor_95_197
>
> Tumor_70_189
>
> Tumor_90_202
>
> Tumor_40_177
>
> Tumor_60_21
>
> Tumor_70_174
>
> Tumor_70_147
>
> Tumor_50_5
>
> ABCC4-2007
>
> 1
>
> 1
>
> 1
>
> 6
>
> 1
>
> 9
>
> 10
>
> 1
>
> 2
>
> 0
>
> 10
>
> 1
>
> ABCC4-2008
>
> 5
>
> 8
>
> 7
>
> 5
>
> 3
>
> 10
>
> 5
>
> 5
>
> 7
>
> 3
>
> 10
>
> 3
>
> ABCC4-2009
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> ABCC4-2010
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> ABCC4-2011
>
> 0
>
> 10
>
> 4
>
> 3
>
> 2
>
> 0
>
> 2
>
> 4
>
> 1
>
> 4
>
> 10
>
> 0
>
> ABCC4-2012
>
> 0
>
> 0
>
> 10
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> ABCC4-2013
>
> 7
>
> 10
>
> 10
>
> 10
>
> 8
>
> 10
>
> 10
>
> 4
>
> 10
>
> 0
>
> 10
>
> 0
>
> ABCG1-0489
>
> 1
>
> 0
>
> 0
>
> 1
>
> 9
>
> 1
>
> 6
>
> 1
>
> 1
>
> 0
>
> 0
>
> 0
>
> ABCG1-0490
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> ABCG1-0491
>
> 2
>
> 0
>
> 2
>
> 3
>
> 1
>
> 1
>
> 2
>
> 2
>
> 5
>
> 2
>
> 1
>
> 7
>
>
>
> Basically 12 different histograms one for each Tumor sample. What is an
> easy way to do this?
>
> I was trying to modify the following example code, but I guess I need
> some help as I am not very comfortable with R
>
> require(lattice)
>
> sundar.theme <- function() {
>        par <- col.whitebg()
>        par$strip.background$col <- rep("#000099", 7)
>        par$add.text$col <- "#eeeeaa"
>        par$add.text$font <- 2
>        par$background$col <- "#ffffff"
>        par$superpose.line$lty <- rep(1, 7)
>        par$superpose.line$col[1:2] <- c("#880000", "#008800")
>        par$superpose.symbol$col[1:2] <- c("#880000", "#008800")
>        par
>      }
>
> trellis.par.set(sundar.theme())
>
> print(  # necessary if the file is source()'d
>  histogram( ~ height | voice.part, data = singer,
>          xlab = "Height (inches)", type = "density",
>          panel = function(x, ...) {
>              panel.histogram(x, ...)
>              panel.mathdensity(dmath = dnorm, col = "black",
>                                args = list(mean=mean(x),sd=sd(x)))
>          } )
>  )
>
>
>
>
>
>
>
> Thanks ../Murli
>
>
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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