Dear developers,
since running 'example(hist)' produces
...
hist> sum(r$density * diff(r$breaks)) # == 1
[1] 0.999
...
I suppose that the current behaviour of hist() is not as intended (and
documented).
So, please find attached (and inline below) a (trivial) patch for
hist.default().
Best
Dear developers,
the current implementation of hist.default() calculates 'density' (and
'intensities') as
dens <- counts/(n*h)
where h has been calculated before as
h <- diff(fuzzybreaks)
which results in 'fuzzy' values for the density, see e.g.
> tmp <- hist(1:10,breaks=c(-2.5,2.5,7.5,12.5)