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
.
cut_interval(x, n = NULL, length = NULL, ...) cut_number(x, n = NULL, ...) cut_width( x, width, center = NULL, boundary = NULL, closed = c("right", "left"), ... )
x | numeric vector |
---|---|
n | number of intervals to create, OR |
length | length of each interval |
... | Arguments passed on to
|
width | The bin width. |
center, boundary | Specify either the position of edge or the center of a bin. Since all bins are aligned, specifying the position of a single bin (which doesn't need to be in the range of the data) affects the location of all bins. If not specified, uses the "tile layers algorithm", and sets the boundary to half of the binwidth. To center on integers, |
closed | One of |
Randall Prium contributed most of the implementation of
cut_width()
.
#> #> [1,10.9] (10.9,20.8] (20.8,30.7] (30.7,40.6] (40.6,50.5] (50.5,60.4] #> 10 10 10 10 10 10 #> (60.4,70.3] (70.3,80.2] (80.2,90.1] (90.1,100] #> 10 10 10 10#> #> [1,10] (10,19] (19,28] (28,37] (37,46] (46,55] (55,64] (64,73] #> 10 9 9 9 9 9 9 9 #> (73,82] (82,91] (91,100] #> 9 9 9#> #> [0.000382,0.0947] (0.0947,0.181] (0.181,0.302] (0.302,0.407] #> 100 100 100 100 #> (0.407,0.498] (0.498,0.604] (0.604,0.728] (0.728,0.814] #> 100 100 100 100 #> (0.814,0.9] (0.9,1] #> 100 100#> #> [-0.05,0.05] (0.05,0.15] (0.15,0.25] (0.25,0.35] (0.35,0.45] (0.45,0.55] #> 48 110 98 96 110 99 #> (0.55,0.65] (0.65,0.75] (0.75,0.85] (0.85,0.95] (0.95,1.05] #> 100 90 111 93 45#> #> [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] #> 89 110 102 92 103 97 101 112 #> (0.8,0.9] (0.9,1] #> 88 106#> #> [-0.05,0.05] (0.05,0.15] (0.15,0.25] (0.25,0.35] (0.35,0.45] (0.45,0.55] #> 48 95 113 117 92 90 #> (0.55,0.65] (0.65,0.75] (0.75,0.85] (0.85,0.95] (0.95,1.05] #> 97 108 107 83 50#> #> 1 2 3 4 5 6 7 8 9 10 11 #> 54 107 90 104 114 107 91 99 86 95 53