[R] Histogram of multiple series on one histogram

Jim Brennan jfbrennan at rogers.com
Fri Jun 3 20:31:13 CEST 2005


Something like this!?!?
R>new
       a  
 [1,] 10 1
 [2,] 20 1
 [3,] 10 1
 [4,] 20 1
 [5,] 30 1
 [6,] 10 2
 [7,] 20 2
 [8,] 20 2
 [9,] 30 2
[10,] 30 2
[11,] 20 3
[12,] 20 3
[13,] 10 3
R>barplot(table(new[,2],new[,1]),beside=T,legend.text=c("a","b","c"))

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Depire Alexandre
Sent: June 3, 2005 12:14 PM
To: r-help at stat.math.ethz.ch
Subject: [R] Histogram of multiple series on one histogram

Hello,
I have three sample, for example
	a<-c(10,20,10,20,30)
	b<-c(10,20,20,30,30)
	c<-c(20,20,10)

I would like to have only one histogram with these series,
I try the following code:
	hist(a)
	hist(b,add=TRUE,col="red")
	hist(c,add=TRUE,col="green")
but it's not that I want 

I would like an histogram with, from left to right, count of "10" for "a", 
count of "10" for "b", count of "10" for "c", count of "20" for "a", count
of 
"20" for "b", ... not overlapped

Thanks


-- 
----------------
Alexandre DEPIRE
INRETS / GARIG
Tel.: (+33) 01 47 40 71 66
Fax: (+33) 01 45 47 56 06
2 av. du général Malleret-Joinville
94114 Arcueil - France

______________________________________________
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




More information about the R-help mailing list