From 7c01cc5b57832cc660f3ef9fd35960309d3795fc Mon Sep 17 00:00:00 2001 From: pvictor Date: Mon, 19 Apr 2021 13:50:40 +0200 Subject: [PATCH] bug filter data with namespace --- DESCRIPTION | 2 +- NAMESPACE | 1 + R/esquisse-server.R | 9 +++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 2dcc343c..681eeaae 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: esquisse Type: Package Title: Explore and Visualize Your Data Interactively -Version: 1.0.0.9010 +Version: 1.0.0.9100 Authors@R: c(person("Fanny", "Meyer", role = c("aut")), person("Victor", "Perrier", email = "victor.perrier@dreamrs.fr", role = c("aut", "cre")), person("Ian", "Carroll", comment = "Faceting support", role = "ctb"), diff --git a/NAMESPACE b/NAMESPACE index ca84047b..82bb97da 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -40,6 +40,7 @@ importFrom(datamods,filter_data_ui) importFrom(datamods,import_modal) importFrom(datamods,import_server) importFrom(datamods,show_data) +importFrom(ggplot2,"%+%") importFrom(ggplot2,aes) importFrom(ggplot2,coord_flip) importFrom(ggplot2,facet_wrap) diff --git a/R/esquisse-server.R b/R/esquisse-server.R index 8b540bf4..5dab3699 100644 --- a/R/esquisse-server.R +++ b/R/esquisse-server.R @@ -13,9 +13,10 @@ #' #' @importFrom shiny moduleServer reactiveValues observeEvent is.reactive #' renderPlot stopApp plotOutput showNotification isolate reactiveValuesToList -#' @importFrom ggplot2 ggplot_build ggsave +#' @importFrom ggplot2 ggplot_build ggsave %+% #' @import ggplot2 #' @importFrom datamods import_modal import_server show_data +#' @importFrom rlang expr sym esquisse_server <- function(id, data_rv = NULL, default_aes = c("fill", "color", "size", "group", "facet"), @@ -331,10 +332,10 @@ esquisse_server <- function(id, ggplotCall$code <- deparse2(gg_call) ggplotCall$call <- gg_call - + ggplotCall$ggobj <- safe_ggplot( - expr = gg_call, - data = setNames(list(data), data_name) + expr = expr((!!gg_call) %+% !!sym("esquisse_data")), + data = setNames(list(data), "esquisse_data") ) ggplotCall$ggobj$plot }, filename = "esquisse-plot")