我正在尝试一个简单的直方图
hist(c(-2,-1,0,1,2))
对于上述代码,直方图的频率等于 -2 到 -1 的 2。
我不太明白 R 如何将值放置在它给出的图中的区间内。我的意思是,这里的频率(y 轴)不应该一直等于 1,因为没有重复?
另外,我不太明白该范围是如何工作的,是包含上限/包含下限还是..?[,) 或 (,] 或 [,] 或 (,) ..?
All your questions can be answered by reading the help file for hist
, help('hist')
or ?hist
There are arguments include.lowest
and right
which both default to TRUE
Quoting from the help
-include.lowest
logical; if TRUE, an x[i] equal to the breaks value will be included in the first (or last, for right = FALSE) bar. This will be ignored (with a warning) unless breaks is a vector.
-right
logical; if TRUE, the histogram cells are right-closed (left open) intervals.