📅  最后修改于: 2022-03-11 14:51:59.434000             🧑  作者: Mango
> a <- runif(100)
> cut(a, seq(from = 0, to = 1, by = 0.2))
[1] (0,0.2] (0.8,1] (0.8,1] (0.6,0.8] (0.6,0.8] (0,0.2] (0.6,0.8]
[8] (0.2,0.4] (0.8,1] (0.4,0.6] (0.8,1] (0.4,0.6] (0.8,1] (0.6,0.8]
[15] (0.8,1] (0,0.2] (0.8,1] (0.8,1] (0.6,0.8] (0.6,0.8] (0.2,0.4]
[22] (0.4,0.6] (0.6,0.8] (0.2,0.4] (0.6,0.8] (0.6,0.8] (0.6,0.8] (0,0.2]
[29] (0,0.2] (0.2,0.4] (0,0.2] (0,0.2] (0,0.2] (0,0.2] (0,0.2]
[36] (0.6,0.8] (0.2,0.4] (0.6,0.8] (0.6,0.8] (0.8,1] (0.2,0.4] (0.4,0.6]
[43] (0.4,0.6] (0.6,0.8] (0.2,0.4] (0.6,0.8] (0.6,0.8] (0.6,0.8] (0.4,0.6]
[50] (0.6,0.8] (0.6,0.8] (0,0.2] (0.2,0.4] (0.8,1] (0.8,1] (0.8,1]
[57] (0.6,0.8] (0.2,0.4] (0.2,0.4] (0,0.2] (0.8,1] (0.8,1] (0.2,0.4]
[64] (0.8,1] (0.2,0.4] (0.4,0.6] (0.8,1] (0,0.2] (0.4,0.6] (0,0.2]
[71] (0.4,0.6] (0.8,1] (0.6,0.8] (0.4,0.6] (0,0.2] (0.2,0.4] (0.4,0.6]
[78] (0,0.2] (0.2,0.4] (0.8,1] (0,0.2] (0.4,0.6] (0.8,1] (0,0.2]
[85] (0,0.2] (0.2,0.4] (0.2,0.4] (0.4,0.6] (0.8,1] (0.2,0.4] (0,0.2]
[92] (0.6,0.8] (0.2,0.4] (0.2,0.4] (0.8,1] (0.2,0.4] (0.4,0.6] (0,0.2]
[99] (0,0.2] (0,0.2]
Levels: (0,0.2] (0.2,0.4] (0.4,0.6] (0.6,0.8] (0.8,1]