Skip to content

Commit ceba7a1

Browse files
committed
invert logic
1 parent 1bfb3c9 commit ceba7a1

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

R/stat-bin.R

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
#' or left edges of bins are included in the bin.
2727
#' @param pad If `TRUE`, adds empty bins at either end of x. This ensures
2828
#' frequency polygons touch 0. Defaults to `FALSE`.
29-
#' @param drop Treatment of zero count bins. If `"all"` (default), such
30-
#' bins are kept as-is. If `"none"`, all zero count bins are filtered out.
31-
#' If `"inner"` only zero count bins at the flanks are filtered out, but not
32-
#' in the middle. `TRUE` is shorthand for `"all"` and `FALSE` is shorthand
29+
#' @param drop Treatment of zero count bins. If `"none"` (default), such
30+
#' bins are kept as-is. If `"all"`, all zero count bins are filtered out.
31+
#' If `"extremes"` only zero count bins at the flanks are filtered out, but
32+
#' not in the middle. `TRUE` is shorthand for `"all"` and `FALSE` is shorthand
3333
#' for `"none"`.
3434
#' @eval rd_computed_vars(
3535
#' count = "number of points in bin.",
@@ -100,9 +100,10 @@ StatBin <- ggproto("StatBin", Stat,
100100
if (is.logical(params$drop)) {
101101
params$drop <- if (isTRUE(params$drop)) "all" else "none"
102102
}
103+
drop <- params$drop
103104
params$drop <- arg_match0(
104-
params$drop %||% "all",
105-
c("all", "none", "inner"), arg_nm = "drop"
105+
params$drop %||% "none",
106+
c("all", "none", "extremes"), arg_nm = "drop"
106107
)
107108

108109
has_x <- !(is.null(data$x) && is.null(params$x))
@@ -146,8 +147,8 @@ StatBin <- ggproto("StatBin", Stat,
146147

147148
keep <- switch(
148149
drop,
149-
none = bins$count != 0,
150-
inner = inner_runs(bins$count != 0),
150+
all = bins$count != 0,
151+
extremes = inner_runs(bins$count != 0),
151152
TRUE
152153
)
153154
bins <- vec_slice(bins, keep)

man/geom_histogram.Rd

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)