From 4c806f8bec7d12e23b49dd2f9c601a67e054347b Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Fri, 12 Oct 2018 20:00:20 +0900 Subject: [PATCH 1/6] Use dev version of rlang --- DESCRIPTION | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0999a6e821..7a57232d53 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -26,7 +26,7 @@ Imports: mgcv, plyr (>= 1.7.1), reshape2, - rlang (>= 0.2.1), + rlang (>= 0.2.99.0), scales (>= 0.5.0), stats, tibble, @@ -243,3 +243,5 @@ VignetteBuilder: knitr RoxygenNote: 6.1.0 Roxygen: list(markdown = TRUE) Encoding: UTF-8 +Remotes: + r-lib/rlang From 699ef0e2a2eb4edb3c80d55ea090a5053deb3638 Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Fri, 12 Oct 2018 20:01:04 +0900 Subject: [PATCH 2/6] Use .ignore_empty = 'all' --- R/aes.r | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/R/aes.r b/R/aes.r index 5b1c1114c7..ecf127494f 100644 --- a/R/aes.r +++ b/R/aes.r @@ -75,10 +75,8 @@ NULL #' cut3 <- function(x) cut_number(x, 3) #' scatter_by(mtcars, cut3(disp), drat) aes <- function(x, y, ...) { - exprs <- rlang::enquos(x = x, y = y, ...) - is_missing <- vapply(exprs, rlang::quo_is_missing, logical(1)) - - aes <- new_aes(exprs[!is_missing], env = parent.frame()) + exprs <- rlang::enquos(x = x, y = y, ..., .ignore_empty = "all") + aes <- new_aes(exprs, env = parent.frame()) rename_aes(aes) } From 506e2ce9128b57f13ca99a8987f9edb0d1bec347 Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Fri, 12 Oct 2018 20:01:35 +0900 Subject: [PATCH 3/6] Fix a test case --- tests/testthat/test-aes.r | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-aes.r b/tests/testthat/test-aes.r index fd36cbc1f0..e3c6ce09e9 100644 --- a/tests/testthat/test-aes.r +++ b/tests/testthat/test-aes.r @@ -89,7 +89,7 @@ test_that("assignment methods pull unwrap constants from quosures", { }) test_that("quosures are squashed when creating default label for a mapping", { - p <- ggplot(mtcars) + aes(!!quo(identity(!!quo(cyl)))) + p <- ggplot(mtcars) + aes(!!rlang::quo(identity(!!rlang::quo(cyl)))) expect_identical(p$labels$x, "identity(cyl)") }) From 615fa05912f651740784013808edcefc3e543cd6 Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Fri, 12 Oct 2018 20:13:14 +0900 Subject: [PATCH 4/6] Use .ignore_empty = 'all' in qplot() as well --- R/quick-plot.r | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/R/quick-plot.r b/R/quick-plot.r index d3aef44357..0dd17f6d67 100644 --- a/R/quick-plot.r +++ b/R/quick-plot.r @@ -71,14 +71,13 @@ qplot <- function(x, y, ..., data, facets = NULL, margins = FALSE, if (!missing(position)) warning("`position` is deprecated", call. = FALSE) if (!is.character(geom)) stop("`geom` must be a character vector", call. = FALSE) - exprs <- rlang::enquos(x = x, y = y, ...) - is_missing <- vapply(exprs, rlang::quo_is_missing, logical(1)) + exprs <- rlang::enquos(x = x, y = y, ..., .ignore_empty = "all") # treat arguments as regular parameters if they are wrapped into I() or # if they don't have a name that is in the list of all aesthetics is_constant <- (!names(exprs) %in% ggplot_global$all_aesthetics) | vapply(exprs, rlang::quo_is_call, logical(1), name = "I") - mapping <- new_aes(exprs[!is_missing & !is_constant], env = parent.frame()) + mapping <- new_aes(exprs[!is_constant], env = parent.frame()) consts <- exprs[is_constant] @@ -90,12 +89,7 @@ qplot <- function(x, y, ..., data, facets = NULL, margins = FALSE, xlab <- rlang::quo_name(exprs$x) } if (is.null(ylab)) { - # Work around quo_name() bug: https://github.com/r-lib/rlang/issues/430 - if (rlang::quo_is_null(exprs$y)) { - ylab <- "NULL" - } else { - ylab <- rlang::quo_name(exprs$y) - } + ylab <- rlang::quo_name(exprs$y) } if (missing(data)) { From 92c14e939a9baa4af126a8585e2536eab30d7722 Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Tue, 23 Oct 2018 09:50:48 +0900 Subject: [PATCH 5/6] Remove Remotes --- DESCRIPTION | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 7a57232d53..243c4b6be4 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -26,7 +26,7 @@ Imports: mgcv, plyr (>= 1.7.1), reshape2, - rlang (>= 0.2.99.0), + rlang (>= 0.3.0), scales (>= 0.5.0), stats, tibble, @@ -243,5 +243,3 @@ VignetteBuilder: knitr RoxygenNote: 6.1.0 Roxygen: list(markdown = TRUE) Encoding: UTF-8 -Remotes: - r-lib/rlang From da9285905920cc0bf1a463b59a9cdd6d8d817782 Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Tue, 23 Oct 2018 09:53:38 +0900 Subject: [PATCH 6/6] Revert a test --- tests/testthat/test-aes.r | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-aes.r b/tests/testthat/test-aes.r index e3c6ce09e9..fd36cbc1f0 100644 --- a/tests/testthat/test-aes.r +++ b/tests/testthat/test-aes.r @@ -89,7 +89,7 @@ test_that("assignment methods pull unwrap constants from quosures", { }) test_that("quosures are squashed when creating default label for a mapping", { - p <- ggplot(mtcars) + aes(!!rlang::quo(identity(!!rlang::quo(cyl)))) + p <- ggplot(mtcars) + aes(!!quo(identity(!!quo(cyl)))) expect_identical(p$labels$x, "identity(cyl)") })