[R] Strange behavior with "hist" function filled with breaks and freq attribute

From: COMTE Guillaume <g.comte_at_alliance-ir.net>
Date: Thu 17 Aug 2006 - 01:34:43 EST

 

Hy all,  

I give example code :  

connexions_jours<-c(1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,6,6,7,7,7,7,7,7,7,7,8,8,8,12,15,19)

pas_de_groupe<-1

hist(connexions_jours,col="red",xlab="Répartition du nombre de connexions par jours (sans break)",main="",ylab="",freq=FALSE)

hist(connexions_jours,breaks=(max(connexions_jours)/pas_de_groupe),col="red",xlab="Répartition du nombre de connexions par jours",main="",ylab="",freq=FALSE)

pas_de_groupe<-5

hist(connexions_jours,breaks=(max(connexions_jours)/pas_de_groupe),col="red",xlab="Répartition du nombre de connexions par jours",main="",ylab="",freq=FALSE)  

As in the R help for ?hist i have :

freq: logical; if 'TRUE', the histogram graphic is a representation

          of frequencies, the 'counts' component of the result; if

'FALSE', _relative_ frequencies ("probabilities"), component

'density', are plotted. Defaults to 'TRUE' _iff_ 'breaks'

          are equidistant (and 'probability' is not specified).  

So i'm plotting 3 graphs of probabilities, but because of the breaks the « y » values seems to be broken as if i have to multiplicate the values shown by the break range to have the real percent.

So i'm wondering why it doesn't show the sum of the probability instead of the average for each values grouped.

Did someone see where i'm wrong?

I'll have a look to barplot, to see if it can handle it, but i still find that strange for hist...  

Thks all

COMTE Guillaume  

        [[alternative HTML version deleted]]



R-help@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. Received on Thu Aug 17 01:34:53 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 17 Aug 2006 - 02:26:50 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.