cut_interval(x, n = NULL, length = NULL, ...)cut_number(x, n = NULL, ...)cut_width(x, width, center = NULL, boundary = NULL, closed = c("right", "left"))
cut
width = 1
and center = 0
.
boundary = 0.5
."right"
or "left"
indicating whether right
or left edges of bins are included in the bin.cut_interval
makes n
groups with equal range, cut_number
makes n
groups with (approximately) equal numbers of observations;
cut_width
makes groups of width width
.
table(cut_interval(1:100, 10))[1,10.9] (10.9,20.8] (20.8,30.7] (30.7,40.6] (40.6,50.5] (50.5,60.4] (60.4,70.3] (70.3,80.2] (80.2,90.1] 10 10 10 10 10 10 10 10 10 (90.1,100] 10table(cut_interval(1:100, 11))[1,10] (10,19] (19,28] (28,37] (37,46] (46,55] (55,64] (64,73] (73,82] (82,91] (91,100] 10 9 9 9 9 9 9 9 9 9 9table(cut_number(runif(1000), 10))[0.000288,0.101] (0.101,0.208] (0.208,0.312] (0.312,0.411] (0.411,0.506] (0.506,0.6] 100 100 100 100 100 100 (0.6,0.718] (0.718,0.811] (0.811,0.913] (0.913,1] 100 100 100 100table(cut_width(runif(1000), 0.1))[-0.05,0.05] (0.05,0.15] (0.15,0.25] (0.25,0.35] (0.35,0.45] (0.45,0.55] (0.55,0.65] (0.65,0.75] 57 77 106 100 106 105 104 85 (0.75,0.85] (0.85,0.95] (0.95,1.05] 109 106 45table(cut_width(runif(1000), 0.1, boundary = 0))[0,0.1] (0.1,0.2] (0.2,0.3] (0.3,0.4] (0.4,0.5] (0.5,0.6] (0.6,0.7] (0.7,0.8] (0.8,0.9] (0.9,1] 96 107 110 101 100 88 93 101 106 98table(cut_width(runif(1000), 0.1, center = 0))[-0.05,0.05] (0.05,0.15] (0.15,0.25] (0.25,0.35] (0.35,0.45] (0.45,0.55] (0.55,0.65] (0.65,0.75] 53 112 94 93 104 104 84 94 (0.75,0.85] (0.85,0.95] (0.95,1.05] 109 97 56