Histogram densities not adding to 1?

I'm trying to make a simple Probability Histogram, but for some reason the densities of each bin are adding up to 0.1 instead of 1. Seems like it should be a very simple problem to solve, but I can't seem to find a solution anywhere.

Thank you in advance.

Your bins are 10 units wide. The key for histograms (and kernelling) is that the area integrates to 1, not sums to 1.

If that is not the answer you want, you can use cuts() or other functions to map your values into factors (bins), then generate a histogram on those factors.

3 Likes