Assuming your data is in a data.frame called df, try this: attach(df) TR.groups <- cut(TvarRatio, seq(0.07, 0.11, 0.01)) m <- table(Mutation_Status, TR.groups) mut.no <- dim(m)[1] barplot(m, col=seq(mut.no), xlab="TvarRatio", ylab="Frequency") legend("topleft", dimnames(m)[[1]], fill=seq(mut.no), title="Mutation_Status")
Jean `·.,, ><(((º> `·.,, ><(((º> `·.,, ><(((º> Jean V. Adams Statistician U.S. Geological Survey Great Lakes Science Center 223 East Steinfest Road Antigo, WI 54409 USA r-help-boun...@r-project.org wrote on 08/10/2011 12:16:51 PM: > [image removed] > > [R] Histograms in R > > lt2 > > to: > > r-help > > 08/10/2011 12:18 PM > > Sent by: > > r-help-boun...@r-project.org > > HI everyone, > I'm plotting a histogram in R and within that histogram i need to > demonstrate the percentage of another variable (Percentage of MutStatus) > within the bins plotted inthe histogram....I don't know how to do that! > > Data:Validation_Status Mutation_Status TvarRatio > Wildtype None 0.08 > Wildtype None 0.08 > Wildtype None 0.08 > Wildtype None 0.08 > Wildtype None 0.080139373 > Wildtype None 0.080152672 > Wildtype None 0.080213904 > Wildtype None 0.080357143 > Wildtype None 0.080357143 > Wildtype None 0.080357143 > Wildtype None 0.08045977 > Wildtype None 0.1 > Wildtype LOH 0.1 > Wildtype None 0.1 > Wildtype None 0.1 > Wildtype None 0.1 > Wildtype None 0.1 > Wildtype None 0.1 > Wildtype Somtatic 0.1 > Wildtype None 0.100558659 > Wildtype None 0.100591716 > Wildtype None 0.101010101 > Wildtype None 0.101123596 > Wildtype Gline 0.101333333 > Wildtype None 0.101369863 > Wildtype None 0.101449275 > Wildtype None 0.101522843 > Wildtype None 0.101604278 > Wildtype None 0.102040816 > Wildtype Gline 0.102040816 > Wildtype None 0.102362205 > Wildtype None 0.102459016 > Wildtype None 0.102564103 > Wildtype None 0.102702703 > Wildtype None 0.102739726 > Wildtype None 0.102803738 > Valid Somatic 0.102941176 > Wildtype None 0.102941176 > > -- > View this message in context: http://r.789695.n4.nabble.com/ > Histograms-in-R-tp3733644p3733644.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@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. [[alternative HTML version deleted]]
______________________________________________ R-help@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.