将物品分成垃圾箱并检索每个垃圾箱中的计数

时间:2014-01-13 16:29:13

标签: r bins

我有一个连续观察的矢量,如下:

x = c(0,0.001,0.03,0.8,0.005,0.6,0.12,0.3,0.75,0.9,0.043,0.81,0.5,0.21,0.27,0.17,1,0.9)

我把它分成二十个箱子,如下:

cut(x, breaks=seq(0,1,by=0.05),include.lowest = TRUE)

如何检索每个垃圾箱中“掉落”的元素数量? 例如,如何判断bin [0,0.05]中有5个项目?

非常感谢!!

0 个答案:

没有答案