Skip to content

Commit 7fdb328

Browse files
committed
x and y should be optional in aes_string
1 parent ca1f1d7 commit 7fdb328

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

R/aes.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ is_position_aes <- function(vars) {
100100
#' aes(mpg, wt, col = cyl, fill = NULL)
101101
#' aes_string("mpg", "wt", col = "cyl", fill = NULL)
102102
#' aes_q(quote(mpg), quote(wt), col = quote(cyl), fill = NULL)
103-
aes_string <- function(x, y, ...) {
104-
mapping <- list(x = x, y = y, ...)
103+
aes_string <- function(x = NULL, y = NULL, ...) {
104+
mapping <- c(compact(list(x = x, y = y)), list(...))
105105
mapping[vapply(mapping, is.null, logical(1))] <- "NULL"
106106

107107
parsed <- lapply(mapping, function(x) parse(text = x)[[1]])

man/aes_string.Rd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
\alias{aes_string}
55
\title{Generate aesthetic mappings from a string/quoted objects}
66
\usage{
7-
aes_string(x, y, ...)
7+
aes_string(x = NULL, y = NULL, ...)
88

99
aes_q(x, y, ...)
1010
}

0 commit comments

Comments
 (0)