Skip to content

Commit 2a3875c

Browse files
committed
rename is.waiver() -> is_waiver() for consistency
1 parent 039aca7 commit 2a3875c

19 files changed

+54
-49
lines changed

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,6 @@ export(is.facet)
473473
export(is.ggplot)
474474
export(is.ggproto)
475475
export(is.theme)
476-
export(is.waiver)
477476
export(is_coord)
478477
export(is_facet)
479478
export(is_geom)
@@ -489,6 +488,7 @@ export(is_scale)
489488
export(is_stat)
490489
export(is_theme)
491490
export(is_theme_element)
491+
export(is_waiver)
492492
export(label_both)
493493
export(label_bquote)
494494
export(label_context)

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ This is a small release focusing on fixing regressions from 3.5.0 and
8787
@yutannihilation's prior work, #3120)
8888
* When discrete breaks have names, they'll be used as labels by default
8989
(@teunbrand, #6147).
90-
* The helper function `is.waiver()` is now exported to help extensions to work
90+
* The helper function `is_waiver()` is now exported to help extensions to work
9191
with `waiver()` objects (@arcresu, #6173).
9292
* Date(time) scales now throw appropriate errors when `date_breaks`,
9393
`date_minor_breaks` or `date_labels` are not strings (@RodDalBen, #5880)

R/axis-secondary.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ is.sec_axis <- function(x) {
129129
}
130130

131131
set_sec_axis <- function(sec.axis, scale) {
132-
if (!is.waiver(sec.axis)) {
132+
if (!is_waiver(sec.axis)) {
133133
if (scale$is_discrete()) {
134134
if (!identical(.subset2(sec.axis, "trans"), identity)) {
135135
cli::cli_abort("Discrete secondary axes must have the {.fn identity} transformation.")
@@ -182,9 +182,9 @@ AxisSecondary <- ggproto("AxisSecondary", NULL,
182182
if (!is.function(transform)) {
183183
cli::cli_abort("Transformation for secondary axes must be a function.")
184184
}
185-
if (is.derived(self$name) && !is.waiver(scale$name)) self$name <- scale$name
185+
if (is.derived(self$name) && !is_waiver(scale$name)) self$name <- scale$name
186186
if (is.derived(self$breaks)) self$breaks <- scale$breaks
187-
if (is.waiver(self$breaks)) {
187+
if (is_waiver(self$breaks)) {
188188
if (scale$is_discrete()) {
189189
self$breaks <- setNames(nm = scale$get_breaks())
190190
} else {

R/coord-sf.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
116116
x_breaks <- graticule$degree[graticule$type == "E"]
117117
if (is.null(scale_x$labels)) {
118118
x_labels <- rep(NA, length(x_breaks))
119-
} else if (is.waiver(scale_x$labels)) {
119+
} else if (is_waiver(scale_x$labels)) {
120120
x_labels <- graticule$degree_label[graticule$type == "E"]
121121
needs_autoparsing[graticule$type == "E"] <- TRUE
122122
} else {
@@ -141,7 +141,7 @@ CoordSf <- ggproto("CoordSf", CoordCartesian,
141141
y_breaks <- graticule$degree[graticule$type == "N"]
142142
if (is.null(scale_y$labels)) {
143143
y_labels <- rep(NA, length(y_breaks))
144-
} else if (is.waiver(scale_y$labels)) {
144+
} else if (is_waiver(scale_y$labels)) {
145145
y_labels <- graticule$degree_label[graticule$type == "N"]
146146
needs_autoparsing[graticule$type == "N"] <- TRUE
147147
} else {
@@ -553,7 +553,7 @@ coord_sf <- function(xlim = NULL, ylim = NULL, expand = TRUE,
553553
ndiscr = 100, default = FALSE, clip = "on",
554554
reverse = "none") {
555555

556-
if (is.waiver(label_graticule) && is.waiver(label_axes)) {
556+
if (is_waiver(label_graticule) && is_waiver(label_axes)) {
557557
# if both `label_graticule` and `label_axes` are set to waive then we
558558
# use the default of labels on the left and at the bottom
559559
label_graticule <- ""
@@ -640,13 +640,13 @@ sf_breaks <- function(scale_x, scale_y, bbox, crs) {
640640
bbox[is.na(bbox)] <- c(-180, -90, 180, 90)[is.na(bbox)]
641641
}
642642

643-
if (!(is.waiver(scale_x$breaks) && is.null(scale_x$n.breaks))) {
643+
if (!(is_waiver(scale_x$breaks) && is.null(scale_x$n.breaks))) {
644644
x_breaks <- scale_x$get_breaks(limits = bbox[c(1, 3)])
645645
finite <- is.finite(x_breaks)
646646
x_breaks <- if (any(finite)) x_breaks[finite] else NULL
647647
}
648648

649-
if (!(is.waiver(scale_y$breaks) && is.null(scale_y$n.breaks))) {
649+
if (!(is_waiver(scale_y$breaks) && is.null(scale_y$n.breaks))) {
650650
y_breaks <- scale_y$get_breaks(limits = bbox[c(2, 4)])
651651
finite <- is.finite(y_breaks)
652652
y_breaks <- if (any(finite)) y_breaks[finite] else NULL

R/facet-null.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ FacetNull <- ggproto("FacetNull", Facet,
3030
layout_null()
3131
},
3232
map_data = function(data, layout, params) {
33-
# Need the is.waiver check for special case where no data, but aesthetics
33+
# Need the is_waiver check for special case where no data, but aesthetics
3434
# are mapped to vectors
35-
if (is.waiver(data))
35+
if (is_waiver(data))
3636
return(data_frame0(PANEL = factor()))
3737

3838
if (empty(data))

R/guide-axis-theta.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ GuideAxisTheta <- ggproto(
196196
}
197197

198198
# Resolve text angle
199-
if (is.waiver(params$angle) || is.null(params$angle)) {
199+
if (is_waiver(params$angle) || is.null(params$angle)) {
200200
angle <- elements$text$angle
201201
} else {
202202
angle <- flip_text_angle(params$angle - rad2deg(key$theta))
@@ -272,7 +272,7 @@ GuideAxisTheta <- ggproto(
272272
}
273273

274274
# Resolve text angle
275-
if (is.waiver(params$angle %||% waiver())) {
275+
if (is_waiver(params$angle %||% waiver())) {
276276
angle <- elements$text$angle
277277
} else {
278278
angle <- flip_text_angle(params$angle - rad2deg(key$theta))

R/guide-bins.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ GuideBins <- ggproto(
341341

342342
parse_binned_breaks <- function(scale, breaks = scale$get_breaks()) {
343343

344-
if (is.waiver(scale$labels) || is.function(scale$labels)) {
344+
if (is_waiver(scale$labels) || is.function(scale$labels)) {
345345
breaks <- breaks[!is.na(breaks)]
346346
}
347347
if (length(breaks) == 0) {

R/guide-custom.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ GuideCustom <- ggproto(
9696
# Render title
9797
params <- replace_null(params, position = position, direction = direction)
9898
elems <- GuideLegend$setup_elements(params, self$elements, theme)
99-
if (!is.waiver(params$title) && !is.null(params$title)) {
99+
if (!is_waiver(params$title) && !is.null(params$title)) {
100100
title <- self$build_title(params$title, elems, params)
101101
} else {
102102
title <- zeroGrob()

R/labels.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ labs <- function(..., title = waiver(), subtitle = waiver(), caption = waiver(),
189189
tag = tag, alt = allow_lambda(alt), alt_insight = alt_insight,
190190
dictionary = dictionary, .ignore_empty = "all")
191191

192-
is_waive <- vapply(args, is.waiver, logical(1))
192+
is_waive <- vapply(args, is_waiver, logical(1))
193193
args <- args[!is_waive]
194194
# remove duplicated arguments
195195
args <- args[!duplicated(names(args))]

R/layer.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ Layer <- ggproto("Layer", NULL,
248248
},
249249

250250
layer_data = function(self, plot_data) {
251-
if (is.waiver(self$data)) {
251+
if (is_waiver(self$data)) {
252252
data <- plot_data
253253
} else if (is.function(self$data)) {
254254
data <- self$data(plot_data)
@@ -258,7 +258,7 @@ Layer <- ggproto("Layer", NULL,
258258
} else {
259259
data <- self$data
260260
}
261-
if (is.null(data) || is.waiver(data)) data else unrowname(data)
261+
if (is.null(data) || is_waiver(data)) data else unrowname(data)
262262
},
263263

264264
# hook to allow a layer access to the final layer data

0 commit comments

Comments
 (0)