Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否已经存在确定数据频率大于某个值的函数/方法?与 Excel 频率分布类似,我想将极值分组到最后一个 bin 中(例如,图像中的 >120)。我一直在手动执行此操作,首先使用 hist 函数,然后对大于给定值的中断计数求和。
这是一个选项:
d <- rlnorm(1000, 3) d.cut <- cut(d, c(seq(0, 120, 10), Inf)) hist(as.numeric(d.cut), breaks=0:13, xaxt='n', xlab='', col=1, border=0, main='', cex.axis=0.8, las=1) axis(1, at=0:13, labels=c(seq(0, 120, 10), '>120'), cex.axis=0.8) box()