[R] how the break is calculated by R?

Richard.Cotton at hsl.gov.uk Richard.Cotton at hsl.gov.uk
Tue May 12 11:09:56 CEST 2009


> As to hist,the help file says:" R's default with equi-spaced breaks 
> (also the default) is to plot the counts in the cells defined by 
breaks." 
> I wanna know how the break is calculated by R? 
> 
> In other words: break = (max - min)/(number of group) but how the 
> "number of group" is calculated by R? Thanks!

If you look closely at the help page for hist, you'll see that in the 
Usage section it says breaks="Sturges".  Then in the Arguments section it 
says that when breaks is a character string, it means it is the name of a 
method to compute the number of cells.  Finally, in the Details section, 
it tells you to look at the nclass.Sturges help page for details of 
Sturges' algorithm.

Wikipedia has a good description of common alorgithms for calculating the 
number of breaks.
http://en.wikipedia.org/wiki/Histogram#Number_of_bins_and_width

Regards,
Richie.

Mathematical Sciences Unit
HSL


------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}




More information about the R-help mailing list