[R] Histogram with equal-counts (-probability)

Uwe Ligges ligges at statistik.uni-dortmund.de
Sun Dec 5 22:16:47 CET 2004


Hamish Macintyre wrote:
> I would like to use R to generate a histogram which has bars of variable bin
> width with each bar having an equal number of counts. For example, if the
> bin limits are the quartiles, each bar would represent 1/4 of the total
> probability in the distribution.
> An example of such an equal-probability histogram is presented by Nicholas
> Cox at http://www.stata.com/support/faqs/graphics/histvary.html.

So you can calculate the quartiles using the quantiles() function and 
set those quartiles as breaks in hist().

Uwe Ligges


> Thanks,
> Hamish
> 
> ______________________________________________
> 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