20
20
# ' table(cut_width(runif(1000), 0.1))
21
21
# ' table(cut_width(runif(1000), 0.1, boundary = 0))
22
22
# ' table(cut_width(runif(1000), 0.1, center = 0))
23
+ # ' table(cut_width(runif(1000), 0.1, labels = FALSE))
23
24
cut_interval <- function (x , n = NULL , length = NULL , ... ) {
24
25
cut(x , breaks(x , " width" , n , length ), include.lowest = TRUE , ... )
25
26
}
@@ -46,7 +47,7 @@ cut_number <- function(x, n = NULL, ...) {
46
47
# ' `boundary = 0.5`.
47
48
# ' @param closed One of `"right"` or `"left"` indicating whether right
48
49
# ' or left edges of bins are included in the bin.
49
- cut_width <- function (x , width , center = NULL , boundary = NULL , closed = c(" right" , " left" )) {
50
+ cut_width <- function (x , width , center = NULL , boundary = NULL , closed = c(" right" , " left" ), ... ) {
50
51
x <- as.numeric(x )
51
52
width <- as.numeric(width )
52
53
@@ -80,7 +81,7 @@ cut_width <- function(x, width, center = NULL, boundary = NULL, closed = c("righ
80
81
max_x <- max(x , na.rm = TRUE ) + (1 - 1e-08 ) * width
81
82
82
83
breaks <- seq(min_x , max_x , width )
83
- cut(x , breaks , include.lowest = TRUE , right = (closed == " right" ))
84
+ cut(x , breaks , include.lowest = TRUE , right = (closed == " right" ), ... )
84
85
}
85
86
86
87
# Find the left side of left-most bin
0 commit comments