Skip to content

Commit 7f13dfa

Browse files
Use .ignore_empty="all" for enquos() (#2936)
1 parent 9292832 commit 7f13dfa

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

R/aes.r

+2-4
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,8 @@ NULL
7575
#' cut3 <- function(x) cut_number(x, 3)
7676
#' scatter_by(mtcars, cut3(disp), drat)
7777
aes <- function(x, y, ...) {
78-
exprs <- rlang::enquos(x = x, y = y, ...)
79-
is_missing <- vapply(exprs, rlang::quo_is_missing, logical(1))
80-
81-
aes <- new_aes(exprs[!is_missing], env = parent.frame())
78+
exprs <- rlang::enquos(x = x, y = y, ..., .ignore_empty = "all")
79+
aes <- new_aes(exprs, env = parent.frame())
8280
rename_aes(aes)
8381
}
8482

R/quick-plot.r

+3-9
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,13 @@ qplot <- function(x, y, ..., data, facets = NULL, margins = FALSE,
7171
if (!missing(position)) warning("`position` is deprecated", call. = FALSE)
7272
if (!is.character(geom)) stop("`geom` must be a character vector", call. = FALSE)
7373

74-
exprs <- rlang::enquos(x = x, y = y, ...)
75-
is_missing <- vapply(exprs, rlang::quo_is_missing, logical(1))
74+
exprs <- rlang::enquos(x = x, y = y, ..., .ignore_empty = "all")
7675
# treat arguments as regular parameters if they are wrapped into I() or
7776
# if they don't have a name that is in the list of all aesthetics
7877
is_constant <- (!names(exprs) %in% ggplot_global$all_aesthetics) |
7978
vapply(exprs, rlang::quo_is_call, logical(1), name = "I")
8079

81-
mapping <- new_aes(exprs[!is_missing & !is_constant], env = parent.frame())
80+
mapping <- new_aes(exprs[!is_constant], env = parent.frame())
8281

8382
consts <- exprs[is_constant]
8483

@@ -90,12 +89,7 @@ qplot <- function(x, y, ..., data, facets = NULL, margins = FALSE,
9089
xlab <- rlang::quo_name(exprs$x)
9190
}
9291
if (is.null(ylab)) {
93-
# Work around quo_name() bug: https://github.com/r-lib/rlang/issues/430
94-
if (rlang::quo_is_null(exprs$y)) {
95-
ylab <- "NULL"
96-
} else {
97-
ylab <- rlang::quo_name(exprs$y)
98-
}
92+
ylab <- rlang::quo_name(exprs$y)
9993
}
10094

10195
if (missing(data)) {

0 commit comments

Comments
 (0)