Skip to content

Commit 5f868c5

Browse files
authored
Implement tidyeval for benchplot()(#2816)
Closes #2699
1 parent c9eb593 commit 5f868c5

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# ggplot2 3.0.0.9000
22

3+
* `benchplot()` now uses tidy evaluation (@dpseidel, #2699).
4+
35
* `fortify()` now displays a more informative error message for
46
`grouped_df()` objects when dplyr is not installed (@jimhester, #2822).
57

R/bench.r

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@
77
#' @examples
88
#' benchplot(ggplot(mtcars, aes(mpg, wt)) + geom_point())
99
#' benchplot(ggplot(mtcars, aes(mpg, wt)) + geom_point() + facet_grid(. ~ cyl))
10-
benchplot <- function(x) {
10+
#'
11+
#' # With tidy eval:
12+
#' p <- expr(ggplot(mtcars, aes(mpg, wt)) + geom_point())
13+
#' benchplot(!!p)
1114

12-
construct <- system.time(force(x))
15+
benchplot <- function(x) {
16+
x <- enquo(x)
17+
construct <- system.time(x <- rlang::eval_tidy(x))
1318
stopifnot(inherits(x, "ggplot"))
1419

1520
build <- system.time(data <- ggplot_build(x))

man/benchplot.Rd

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

0 commit comments

Comments
 (0)