使用切割创建从0开始的断裂
如何使用cut()
函数来创建从0开始的断裂?
x <- seq(0, 102, length.out = 15)
cut(x, breaks = 10)
[1] (-0.102,10.2] (-0.102,10.2] (10.2,20.4] (20.4,30.6] (20.4,30.6] (30.6,40.8] (40.8,51] (40.8,51] (51,61.2] (61.2,71.4] (71.4,81.6] (71.4,81.6]
[13] (81.6,91.8] (91.8,102] (91.8,102]
Levels: (-0.102,10.2] (10.2,20.4] (20.4,30.6] (30.6,40.8] (40.8,51] (51,61.2] (61.2,71.4] (71.4,81.6] (81.6,91.8] (91.8,102]
how can i use the cut()
function to create breaks that start at 0?
x <- seq(0, 102, length.out = 15)
cut(x, breaks = 10)
[1] (-0.102,10.2] (-0.102,10.2] (10.2,20.4] (20.4,30.6] (20.4,30.6] (30.6,40.8] (40.8,51] (40.8,51] (51,61.2] (61.2,71.4] (71.4,81.6] (71.4,81.6]
[13] (81.6,91.8] (91.8,102] (91.8,102]
Levels: (-0.102,10.2] (10.2,20.4] (20.4,30.6] (30.6,40.8] (40.8,51] (51,61.2] (61.2,71.4] (71.4,81.6] (81.6,91.8] (91.8,102]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基本函数 输出漂亮的数字。从文档中,我的重点。
由
Base function
pretty
outputs pretty numbers. From the documentation, my emphasis.Created on 2022-06-13 by the reprex package (v2.0.1)