From adce4e2be1154949011a0790911b3a82edf74508 Mon Sep 17 00:00:00 2001 From: Kara Woo Date: Fri, 24 Aug 2018 07:44:28 -0700 Subject: [PATCH] Only print the names of the aesthetics with mismatched length (#2853) * Only print the names of the aesthetics with mismatched length * Add NEWS.md bullet --- NEWS.md | 4 ++++ R/geom-.r | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index baf9a42262..5790878953 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # ggplot2 3.0.0.9000 +* The error message in `compute_aesthetics()` now provides the names of only + aesthetics with mismatched lengths, rather than all aesthetics (@karawoo, + #2853). + * `geom_sf()` now respects `lineend`, `linejoin`, and `linemitre` parameters for lines and polygons (@alistaire47, #2826) diff --git a/R/geom-.r b/R/geom-.r index 6ddb7a1499..c5050349cd 100644 --- a/R/geom-.r +++ b/R/geom-.r @@ -184,7 +184,7 @@ check_aesthetics <- function(x, n) { stop( "Aesthetics must be either length 1 or the same as the data (", n, "): ", - paste(names(!good), collapse = ", "), + paste(names(which(!good)), collapse = ", "), call. = FALSE ) }