Skip to content

Commit 5aacacb

Browse files
committed
Add support for multiple problematic aesthetics, fix NEWS.md addition
1 parent 81e45ea commit 5aacacb

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

NEWS.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ core developer team.
8383

8484
* Clearer error messages for inappropriate aesthetics (@clairemcwhite, #3060).
8585

86-
* `geom_rug()` gains an "outside" option to allow for moving the rug tassels to outside the plot area. (@njtierney, #3085)
87-
8886
* ggplot2 no longer attaches any external packages when using functions that
8987
depend on packages that are suggested but not imported by ggplot2. The
9088
affected functions include `geom_hex()`, `stat_binhex()`,

R/layer.r

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,9 @@ Layer <- ggproto("Layer", NULL,
232232
nondata_cols <- check_nondata_cols(evaled)
233233
if (length(nondata_cols) > 0) {
234234
msg <- paste0(
235-
"Aesthetics must be valid data columns. Problematic aesthetic(s): ", as_label(aesthetics[[nondata_cols]]),
236-
". Did you mistype the name of a data column or forget to add stat()?"
235+
"Aesthetics must be valid data columns. Problematic aesthetic(s): ",
236+
paste0(vapply(nondata_cols, function(x) {as_label(aesthetics[[x]])}, character(1)), collapse = ", "),
237+
". \nDid you mistype the name of a data column or forget to add stat()?"
237238
)
238239
stop(msg, call. = FALSE)
239240
}
@@ -294,8 +295,9 @@ Layer <- ggproto("Layer", NULL,
294295
nondata_stat_cols <- check_nondata_cols(stat_data)
295296
if (length(nondata_stat_cols) > 0) {
296297
msg <- paste0(
297-
"Aesthetics must be valid computed stats. Problematic aesthetic(s): ", as_label(aesthetics[[nondata_stat_cols]]),
298-
". Did you map your stat in the wrong layer?"
298+
"Aesthetics must be valid computed stats. Problematic aesthetic(s): ",
299+
paste0(vapply(nondata_stat_cols, function(x) {as_label(aesthetics[[x]])}, character(1)), collapse = ", "),
300+
". \nDid you map your stat in the wrong layer?"
299301
)
300302
stop(msg, call. = FALSE)
301303
}

0 commit comments

Comments
 (0)