From b0d1a0c7de8ab5ccc0349bc765196e179e85a896 Mon Sep 17 00:00:00 2001 From: Teun van den Brand Date: Wed, 7 Feb 2024 10:00:39 +0100 Subject: [PATCH] revert 5657, instead explicitly restore AsIs --- R/geom-.R | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/R/geom-.R b/R/geom-.R index 3a400f9c51..4b8952d4fa 100644 --- a/R/geom-.R +++ b/R/geom-.R @@ -172,8 +172,16 @@ Geom <- ggproto("Geom", # Override mappings with params aes_params <- intersect(self$aesthetics(), names(params)) - check_aesthetics(params[aes_params], nrow(data)) - vec_cbind(data[setdiff(names(data), aes_params)], !!!params[aes_params]) + new_params <- params[aes_params] + check_aesthetics(new_params, nrow(data)) + data[aes_params] <- new_params + + # Restore any AsIs classes (#5656) + is_asis <- which(vapply(new_params, inherits, what = "AsIs", logical(1))) + for (i in aes_params[is_asis]) { + data[[i]] <- I(data[[i]]) + } + data }, # Most parameters for the geom are taken automatically from draw_panel() or