# [R] Histogram questions

M. Edward (Ed) Borasky znmeb at aracnet.com
Mon Feb 5 22:53:20 CET 2001

```Questions on histograms:

1. When I run "hist" on a data set, the histogram object produced has two
variables, "\$density" and "\$intensities". These appear to be the same:

\$intensities
[1] 1.7619226436 0.0360495682 0.1967705595 0.0000000000 0.0037551633
[6] 0.0000000000 0.0007510327 0.0007510327

\$density
[1] 1.7619226436 0.0360495682 0.1967705595 0.0000000000 0.0037551633
[6] 0.0000000000 0.0007510327 0.0007510327

Why are they the same? Are both necessary?

2. I want to plot histograms that are normalized -- that is, the sum of the
intensities or density is 1.0, so the bars represent probabilities. As it's set
up now, I have to do this calculation manually. Why can't R do this when it
calculates the values? If I specify "probability=TRUE", I expect probabilities,
not some arbitrarily scaled value.

3. What would be even nicer is to have "hist" and "density" *both* scale their
outputs as probabilities, so they could be overlaid on a plot together. How
difficult is this to do?
--
znmeb at aracnet.com (M. Edward Borasky) http://www.aracnet.com/~znmeb

If there's nothing to astrology, how come so many famous men were born
on holidays?

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```