R-breaks参数中的直方图函数不起作用
我喜欢使用定义的分隔符为每行创建直方图对象:R-breaks参数中的直方图函数不起作用,r,plot,histogram,R,Plot,Histogram,我喜欢使用定义的分隔符为每行创建直方图对象: Hist <- list() for (i in 1:10) { Hist[[i]] <- hist(data[i,],breaks=25) } Hist要获得一致的中断,请指定一个向量。不是一个整数,正如你所料! 是的,这是有原因的;)从直方图帮助页面:?hist: `breaks` can be one of: 1. a vector giving the breakpoints between histogram
Hist <- list()
for (i in 1:10) {
Hist[[i]] <- hist(data[i,],breaks=25)
}
Hist要获得一致的中断
,请指定一个向量。不是一个整数,正如你所料!
是的,这是有原因的;)从直方图帮助页面:?hist
:
`breaks` can be one of:
1. a vector giving the breakpoints between histogram cells,
2. a function to compute the vector of breakpoints,
3. a single number giving the number of cells for the histogram,
4. a character string naming an algorithm to compute the number of cells (see ‘Details’),
5. a function to compute the number of cells.
在案例3、4、5中,数字只是一个建议;断点将被设置为漂亮的值。如果breaks
是一个函数,则将x
向量作为唯一参数提供给它
请注意,我在粗体中突出显示的部分AFAIKbreaks
只是一个提示,并不总是对hist有效。@rbm:好的,但解释器确实应该告诉用户“忽略用户指定的breaks
=25,使用32…”否则这太难说了……非常感谢。首先,我遇到了一个错误:“一些‘x’不被计算;也许‘breaks’不在‘x’的范围内”,但我发现这里的默认值是直方图单元格是右关闭(左打开)的间隔。现在它正在工作。