[R] trouble with histograms

Marcel Curlin cemarcel at u.washington.edu
Wed Oct 27 07:00:44 CEST 2010


Hi,
I have tab-delimited data with an unequal number of entries per column, of
the sort:

A   B   C
1   2   2
3   4   1
5   2   2   
6   2
5   2
3
6
2

I would like to make a histogram of the frequencies of each represented
number in a "stacked" histogram, where you can see the contribution of each
group (A, B or C) to the total height of the bar, and each bar labeled with
the represented number. So, there would be a bar labeled "1" of height 2,
half one color for group A, and half another color for group B.

So far,
I can get my data into a dataframe
>data <- read.table("myfile")

I think I first have to use "hist" to get the frequencies of each, and I
have figured out how to use breaks to make bins;
> bins=seq(0.5,6.5,by=1)
>hist(data$A, header=T, sep="\t", breaks=bins)

Lots of trouble from then on, though, and I just can't get this into a
usable plot. Any help appreciated.

Marcel
-- 
View this message in context: http://r.789695.n4.nabble.com/trouble-with-histograms-tp3014838p3014838.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list