Skip to content

hist()

1 message · Brian Ripley

#
Since a histogram is intended to be of continuous data, it should
not really matter. And if the data are already rounded (like ages) it
matters how they were rounded. (One of my grandfathers would
say he was `in his eighty-second year', so the rounding direction
may even depend on the value.)  My example below shows that rounding
error can play havoc with one's intentions too.

Since cut in R has an argument `right', could not hist have too?
And I don't actually understand why hist.default does not call cut.default
directly, when enhancements to cut will be easy to apply to hist.
Then we can argue about the default for right. It seems to me that
it should be the same for cut and for hist, and I would argue for
not changing the current default (whatever it might have been).

Oh, and what do bincode and bincode2 do about rounding error? (Nothing,
I think.) The default breaks in cut and hist are computed quantities,
and as we know, seq does not always get them exactly right.
As in:
[1] (0.249,0.35] (0.35,0.45]  (0.45,0.55]  (0.45,0.55]  (0.55,0.65] 
[6] (0.65,0.75]  (0.75,0.851]
[1] [0.249,0.35) [0.35,0.45)  [0.45,0.55)  [0.55,0.65)  [0.55,0.65) 
[6] [0.65,0.75)  [0.75,0.851)

(R 0.63.0 and others) !!!

Brian