From 388d5c9d295f1f6bd8d66cf949dd162df8b05f95 Mon Sep 17 00:00:00 2001 From: m7pr Date: Wed, 20 Nov 2024 14:51:53 +0100 Subject: [PATCH 1/5] WIP on tm_outliers --- R/tm_outliers.R | 96 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 74 insertions(+), 22 deletions(-) diff --git a/R/tm_outliers.R b/R/tm_outliers.R index dab983f2d..99d3d48ed 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -11,17 +11,37 @@ #' Specifies variable(s) to be analyzed for outliers. #' @param categorical_var (`data_extract_spec` or `list` of multiple `data_extract_spec`) optional, #' specifies the categorical variable(s) to split the selected outlier variables on. +#' @param table_decorator (`list` of `teal_transform_module`) optional, +#' decorator for the table. +#' @param boxplot_decorator (`list` of `teal_transform_module`) optional, +#' decorator for the box plot. +#' @param violin_decorator (`list` of `teal_transform_module`) optional, +#' decorator for the violin plot. +#' @param density_decorator (`list` of `teal_transform_module`) optional, +#' decorator for the density plot. +#' @param cum_dist_decorator (`list` of `teal_transform_module`) optional, +#' decorator for the cumulative distribution plot. #' #' @templateVar ggnames "Boxplot","Density Plot","Cumulative Distribution Plot" #' @template ggplot2_args_multi #' #' @inherit shared_params return #' +#' @section Decorating `tm_outliers`: +#' +#' This module generates the following objects, which can be modified in place using decorators: +#' - `table` (`data.frame`) +#' - `plot` (`ggplot2`) +#' +#' For additional details and examples of decorators, refer to the vignette +#' `vignette("decorate-modules-output", package = "teal")` or the [`teal_transform_module()`] documentation. +#' #' @examplesShinylive #' library(teal.modules.general) #' interactive <- function() TRUE #' {{ next_example }} #' @examples +#' #' # general data example #' data <- teal_data() #' data <- within(data, { @@ -71,6 +91,7 @@ #' interactive <- function() TRUE #' {{ next_example }} #' @examples +#' #' # CDISC data example #' data <- teal_data() #' data <- within(data, { @@ -81,6 +102,8 @@ #' fact_vars_adsl <- names(Filter(isTRUE, sapply(data[["ADSL"]], is.factor))) #' vars <- choices_selected(variable_choices(data[["ADSL"]], fact_vars_adsl)) #' +#' +#' #' app <- init( #' data = data, #' modules = modules( @@ -125,7 +148,12 @@ tm_outliers <- function(label = "Outliers Module", plot_height = c(600, 200, 2000), plot_width = NULL, pre_output = NULL, - post_output = NULL) { + post_output = NULL, + table_decorator = teal_transform_module(), + boxplot_decorator = teal_transform_module(), + violin_decorator = teal_transform_module(), + density_decorator = teal_transform_module(), + cum_dist_decorator = teal_transform_module()) { message("Initializing tm_outliers") # Normalize the parameters @@ -172,15 +200,19 @@ tm_outliers <- function(label = "Outliers Module", categorical_var = categorical_var ) + ans <- module( label = label, server = srv_outliers, server_args = c( data_extract_list, - list(plot_height = plot_height, plot_width = plot_width, ggplot2_args = ggplot2_args) + list( + plot_height = plot_height, plot_width = plot_width, ggplot2_args = ggplot2_args, + decorators = list(table = table_decorator, boxplot = boxplot_decorator, violin = violin_decorator, density = density_decorator, cum_dist = cum_dist_decorator) + ) ), ui = ui_outliers, - ui_args = args, + ui_args = c(args), datanames = teal.transform::get_extract_datanames(data_extract_list) ) attr(ans, "teal_bookmarkable") <- TRUE @@ -197,20 +229,31 @@ ui_outliers <- function(id, ...) { output = teal.widgets::white_small_well( uiOutput(ns("total_outliers")), DT::dataTableOutput(ns("summary_table")), + ui_teal_transform_data(ns("table_decorator"), args$table_decorator), uiOutput(ns("total_missing")), tags$br(), tags$hr(), tabsetPanel( id = ns("tabs"), tabPanel( "Boxplot", + conditionalPanel( + condition = sprintf("input['%s'] == 'Box plot'", ns("boxplot_alts")), + ui_teal_transform_data(ns("boxplot_decorator"), args$boxplot_decorator) + ), + conditionalPanel( + condition = sprintf("input['%s'] == 'Violin plot'", ns("boxplot_alts")), + ui_teal_transform_data(ns("violin_decorator"), args$violin_decorator) + ), teal.widgets::plot_with_settings_ui(id = ns("box_plot")) ), tabPanel( "Density Plot", + ui_teal_transform_data(ns("density_decorator"), args$density_decorator), teal.widgets::plot_with_settings_ui(id = ns("density_plot")) ), tabPanel( "Cumulative Distribution Plot", + ui_teal_transform_data(ns("cum_dist_decorator"), args$cum_dist_decorator), teal.widgets::plot_with_settings_ui(id = ns("cum_density_plot")) ) ), @@ -319,9 +362,10 @@ ui_outliers <- function(id, ...) { ) } +# Server function for the outliers module # Server function for the outliers module srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, - categorical_var, plot_height, plot_width, ggplot2_args) { + categorical_var, plot_height, plot_width, ggplot2_args, decorators) { with_reporter <- !missing(reporter) && inherits(reporter, "Reporter") with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI") checkmate::assert_class(data, "reactive") @@ -761,7 +805,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, teal.code::eval_code( common_code_q(), substitute( - expr = g <- plot_call + + expr = plot <- plot_call + scale_color_manual(values = c("TRUE" = "red", "FALSE" = "black")) + labs + ggthemes + themes, env = list( @@ -771,8 +815,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, themes = parsed_ggplot2_args$theme ) ) - ) %>% - teal.code::eval_code(quote(print(g))) + ) }) # density plot @@ -823,7 +866,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, teal.code::eval_code( common_code_q(), substitute( - expr = g <- plot_call + labs + ggthemes + themes, + expr = plot <- plot_call + labs + ggthemes + themes, env = list( plot_call = plot_call, labs = parsed_ggplot2_args$labs, @@ -831,8 +874,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, ggthemes = parsed_ggplot2_args$ggtheme ) ) - ) %>% - teal.code::eval_code(quote(print(g))) + ) }) # Cumulative distribution plot @@ -925,7 +967,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, teal.code::eval_code( qenv, substitute( - expr = g <- plot_call + + expr = plot <- plot_call + geom_point(data = outlier_points, aes(x = outlier_var_name, y = y, color = is_outlier_selected)) + scale_color_manual(values = c("TRUE" = "red", "FALSE" = "black")) + labs + ggthemes + themes, @@ -937,19 +979,24 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, ggthemes = parsed_ggplot2_args$ggtheme ) ) - ) %>% - teal.code::eval_code(quote(print(g))) + ) }) + decorated_boxplot_q <- srv_teal_transform_data("boxplot_decorator", data = boxplot_q, transformators = decorators$boxplot) + decorated_violin_q <- srv_teal_transform_data("violin_decorator", data = boxplot_q, transformators = decorators$violin) + # TODO decorated_violin_q is not used anywhere + decorated_density_plot_q <- srv_teal_transform_data("density_decorator", data = density_plot_q, transformators = decorators$density) + decorated_cumulative_plot_q <- srv_teal_transform_data("cum_dist_decorator", data = cumulative_plot_q, transformators = decorators$cum_dist) + final_q <- reactive({ req(input$tabs) tab_type <- input$tabs result_q <- if (tab_type == "Boxplot") { - boxplot_q() + decorated_boxplot_q() } else if (tab_type == "Density Plot") { - density_plot_q() + decorated_density_plot_q() } else if (tab_type == "Cumulative Distribution Plot") { - cumulative_plot_q() + decorated_cumulative_plot_q() } # used to display table when running show-r-code code # added after the plots so that a change in selected columns doesn't affect @@ -962,7 +1009,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, setdiff(names(ANL_OUTLIER), c("is_outlier_selected", "order")), table_columns ) - ANL_OUTLIER_EXTENDED[ANL_OUTLIER_EXTENDED$is_outlier_selected, columns_index] + table <- ANL_OUTLIER_EXTENDED[ANL_OUTLIER_EXTENDED$is_outlier_selected, columns_index] }, env = list( table_columns = input$table_ui_columns @@ -971,6 +1018,11 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, ) }) + + decorated_final_q <- + srv_teal_transform_data("cum_dist_decorator", data = final_q, transformators = decorators$table_decorator) + # TODO: reuse decorated_final_q in table generation + # slider text output$ui_outlier_help <- renderUI({ req(input$method) @@ -1021,15 +1073,15 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, boxplot_r <- reactive({ teal::validate_inputs(iv_r()) - boxplot_q()[["g"]] + decorated_boxplot_q()[["plot"]] }) density_plot_r <- reactive({ teal::validate_inputs(iv_r()) - density_plot_q()[["g"]] + decorated_density_plot_q()[["plot"]] }) cumulative_plot_r <- reactive({ teal::validate_inputs(iv_r()) - cumulative_plot_q()[["g"]] + decorated_cumulative_plot_q()[["plot"]] }) box_pws <- teal.widgets::plot_with_settings_srv( @@ -1217,7 +1269,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, teal.widgets::verbatim_popup_srv( id = "rcode", - verbatim_content = reactive(teal.code::get_code(final_q())), + verbatim_content = reactive(teal.code::get_code(req(final_q()))), title = "Show R Code for Outlier" ) @@ -1249,7 +1301,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, card$append_text("Comment", "header3") card$append_text(comment) } - card$append_src(teal.code::get_code(final_q())) + card$append_src(teal.code::get_code(req(final_q()))) card } teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun) From 6a36fe5b8d8423d13ec8ff3b51603f19fec9505c Mon Sep 17 00:00:00 2001 From: m7pr Date: Thu, 21 Nov 2024 13:05:06 +0100 Subject: [PATCH 2/5] add req statement so that when srv_teal_transform_data returns NULL you see error from original teal_data --- R/tm_outliers.R | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/R/tm_outliers.R b/R/tm_outliers.R index 99d3d48ed..f4cd8a81b 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -11,15 +11,15 @@ #' Specifies variable(s) to be analyzed for outliers. #' @param categorical_var (`data_extract_spec` or `list` of multiple `data_extract_spec`) optional, #' specifies the categorical variable(s) to split the selected outlier variables on. -#' @param table_decorator (`list` of `teal_transform_module`) optional, +#' @param table_decorator (`list` of `teal_transform_module` or `NULL`) optional, #' decorator for the table. -#' @param boxplot_decorator (`list` of `teal_transform_module`) optional, +#' @param boxplot_decorator (`list` of `teal_transform_module` or `NULL`) optional, #' decorator for the box plot. -#' @param violin_decorator (`list` of `teal_transform_module`) optional, +#' @param violin_decorator (`list` of `teal_transform_module` or `NULL`) optional, #' decorator for the violin plot. -#' @param density_decorator (`list` of `teal_transform_module`) optional, +#' @param density_decorator (`list` of `teal_transform_module` or `NULL`) optional, #' decorator for the density plot. -#' @param cum_dist_decorator (`list` of `teal_transform_module`) optional, +#' @param cum_dist_decorator (`list` of `teal_transform_module` or `NULL`) optional, #' decorator for the cumulative distribution plot. #' #' @templateVar ggnames "Boxplot","Density Plot","Cumulative Distribution Plot" @@ -149,11 +149,11 @@ tm_outliers <- function(label = "Outliers Module", plot_width = NULL, pre_output = NULL, post_output = NULL, - table_decorator = teal_transform_module(), - boxplot_decorator = teal_transform_module(), - violin_decorator = teal_transform_module(), - density_decorator = teal_transform_module(), - cum_dist_decorator = teal_transform_module()) { + table_decorator = NULL, + boxplot_decorator = NULL, + violin_decorator = NULL, + density_decorator = NULL, + cum_dist_decorator = NULL) { message("Initializing tm_outliers") # Normalize the parameters @@ -190,6 +190,13 @@ tm_outliers <- function(label = "Outliers Module", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) + + checkmate::check_class(table_decorator, "teal_transform_module", null.ok = TRUE) + checkmate::check_class(boxplot_decorator, "teal_transform_module", null.ok = TRUE) + checkmate::check_class(violin_decorator, "teal_transform_module", null.ok = TRUE) + checkmate::check_class(density_decorator, "teal_transform_module", null.ok = TRUE) + checkmate::check_class(cum_dist_decorator, "teal_transform_module", null.ok = TRUE) + # End of assertions # Make UI args @@ -1073,14 +1080,17 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, boxplot_r <- reactive({ teal::validate_inputs(iv_r()) + req(boxplot_q()) decorated_boxplot_q()[["plot"]] }) density_plot_r <- reactive({ teal::validate_inputs(iv_r()) + req(density_plot_q()) decorated_density_plot_q()[["plot"]] }) cumulative_plot_r <- reactive({ teal::validate_inputs(iv_r()) + req(cumulative_plot_q()) decorated_cumulative_plot_q()[["plot"]] }) From efab96188f18fffe124ef5fedd9d9824e4e62c0a Mon Sep 17 00:00:00 2001 From: m7pr Date: Mon, 25 Nov 2024 13:49:15 +0100 Subject: [PATCH 3/5] finalize tm_outliers --- R/tm_outliers.R | 71 +++++++++++++------------------------------------ 1 file changed, 18 insertions(+), 53 deletions(-) diff --git a/R/tm_outliers.R b/R/tm_outliers.R index f4cd8a81b..758522be1 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -11,16 +11,6 @@ #' Specifies variable(s) to be analyzed for outliers. #' @param categorical_var (`data_extract_spec` or `list` of multiple `data_extract_spec`) optional, #' specifies the categorical variable(s) to split the selected outlier variables on. -#' @param table_decorator (`list` of `teal_transform_module` or `NULL`) optional, -#' decorator for the table. -#' @param boxplot_decorator (`list` of `teal_transform_module` or `NULL`) optional, -#' decorator for the box plot. -#' @param violin_decorator (`list` of `teal_transform_module` or `NULL`) optional, -#' decorator for the violin plot. -#' @param density_decorator (`list` of `teal_transform_module` or `NULL`) optional, -#' decorator for the density plot. -#' @param cum_dist_decorator (`list` of `teal_transform_module` or `NULL`) optional, -#' decorator for the cumulative distribution plot. #' #' @templateVar ggnames "Boxplot","Density Plot","Cumulative Distribution Plot" #' @template ggplot2_args_multi @@ -30,8 +20,9 @@ #' @section Decorating `tm_outliers`: #' #' This module generates the following objects, which can be modified in place using decorators: -#' - `table` (`data.frame`) -#' - `plot` (`ggplot2`) +#' - `box_plot` (`ggplot2`) +#' - `density_plot` (`ggplot2`) +#' - `cum_dist_plot` (`ggplot2`) #' #' For additional details and examples of decorators, refer to the vignette #' `vignette("decorate-modules-output", package = "teal")` or the [`teal_transform_module()`] documentation. @@ -149,11 +140,7 @@ tm_outliers <- function(label = "Outliers Module", plot_width = NULL, pre_output = NULL, post_output = NULL, - table_decorator = NULL, - boxplot_decorator = NULL, - violin_decorator = NULL, - density_decorator = NULL, - cum_dist_decorator = NULL) { + decorators = NULL) { message("Initializing tm_outliers") # Normalize the parameters @@ -191,11 +178,7 @@ tm_outliers <- function(label = "Outliers Module", checkmate::assert_multi_class(pre_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) - checkmate::check_class(table_decorator, "teal_transform_module", null.ok = TRUE) - checkmate::check_class(boxplot_decorator, "teal_transform_module", null.ok = TRUE) - checkmate::check_class(violin_decorator, "teal_transform_module", null.ok = TRUE) - checkmate::check_class(density_decorator, "teal_transform_module", null.ok = TRUE) - checkmate::check_class(cum_dist_decorator, "teal_transform_module", null.ok = TRUE) + checkmate::assert_list(decorators, "teal_transform_module", null.ok = TRUE) # End of assertions @@ -215,7 +198,7 @@ tm_outliers <- function(label = "Outliers Module", data_extract_list, list( plot_height = plot_height, plot_width = plot_width, ggplot2_args = ggplot2_args, - decorators = list(table = table_decorator, boxplot = boxplot_decorator, violin = violin_decorator, density = density_decorator, cum_dist = cum_dist_decorator) + decorators = decorators ) ), ui = ui_outliers, @@ -236,31 +219,21 @@ ui_outliers <- function(id, ...) { output = teal.widgets::white_small_well( uiOutput(ns("total_outliers")), DT::dataTableOutput(ns("summary_table")), - ui_teal_transform_data(ns("table_decorator"), args$table_decorator), + uiOutput(ns("total_missing")), tags$br(), tags$hr(), tabsetPanel( id = ns("tabs"), tabPanel( "Boxplot", - conditionalPanel( - condition = sprintf("input['%s'] == 'Box plot'", ns("boxplot_alts")), - ui_teal_transform_data(ns("boxplot_decorator"), args$boxplot_decorator) - ), - conditionalPanel( - condition = sprintf("input['%s'] == 'Violin plot'", ns("boxplot_alts")), - ui_teal_transform_data(ns("violin_decorator"), args$violin_decorator) - ), teal.widgets::plot_with_settings_ui(id = ns("box_plot")) ), tabPanel( "Density Plot", - ui_teal_transform_data(ns("density_decorator"), args$density_decorator), teal.widgets::plot_with_settings_ui(id = ns("density_plot")) ), tabPanel( "Cumulative Distribution Plot", - ui_teal_transform_data(ns("cum_dist_decorator"), args$cum_dist_decorator), teal.widgets::plot_with_settings_ui(id = ns("cum_density_plot")) ) ), @@ -350,6 +323,7 @@ ui_outliers <- function(id, ...) { uiOutput(ns("ui_outlier_help")) ) ), + ui_transform_teal_data(ns("decorate"), transformators = args$decorators), teal.widgets::panel_item( title = "Plot settings", selectInput( @@ -989,21 +963,15 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, ) }) - decorated_boxplot_q <- srv_teal_transform_data("boxplot_decorator", data = boxplot_q, transformators = decorators$boxplot) - decorated_violin_q <- srv_teal_transform_data("violin_decorator", data = boxplot_q, transformators = decorators$violin) - # TODO decorated_violin_q is not used anywhere - decorated_density_plot_q <- srv_teal_transform_data("density_decorator", data = density_plot_q, transformators = decorators$density) - decorated_cumulative_plot_q <- srv_teal_transform_data("cum_dist_decorator", data = cumulative_plot_q, transformators = decorators$cum_dist) - final_q <- reactive({ req(input$tabs) tab_type <- input$tabs result_q <- if (tab_type == "Boxplot") { - decorated_boxplot_q() + boxplot_q() } else if (tab_type == "Density Plot") { - decorated_density_plot_q() + density_plot_q() } else if (tab_type == "Cumulative Distribution Plot") { - decorated_cumulative_plot_q() + cumulative_plot_q() } # used to display table when running show-r-code code # added after the plots so that a change in selected columns doesn't affect @@ -1016,7 +984,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, setdiff(names(ANL_OUTLIER), c("is_outlier_selected", "order")), table_columns ) - table <- ANL_OUTLIER_EXTENDED[ANL_OUTLIER_EXTENDED$is_outlier_selected, columns_index] + ANL_OUTLIER_EXTENDED[ANL_OUTLIER_EXTENDED$is_outlier_selected, columns_index] }, env = list( table_columns = input$table_ui_columns @@ -1025,10 +993,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, ) }) - - decorated_final_q <- - srv_teal_transform_data("cum_dist_decorator", data = final_q, transformators = decorators$table_decorator) - # TODO: reuse decorated_final_q in table generation + decorated_final_q <- srv_transform_teal_data("decorate", data = final_q, transformators = decorators) # slider text output$ui_outlier_help <- renderUI({ @@ -1081,17 +1046,17 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, boxplot_r <- reactive({ teal::validate_inputs(iv_r()) req(boxplot_q()) - decorated_boxplot_q()[["plot"]] + decorated_final_q()[["box_plot"]] }) density_plot_r <- reactive({ teal::validate_inputs(iv_r()) req(density_plot_q()) - decorated_density_plot_q()[["plot"]] + decorated_final_q()[["density_plot"]] }) cumulative_plot_r <- reactive({ teal::validate_inputs(iv_r()) req(cumulative_plot_q()) - decorated_cumulative_plot_q()[["plot"]] + decorated_final_q()[["cum_dist_plot"]] }) box_pws <- teal.widgets::plot_with_settings_srv( @@ -1279,7 +1244,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, teal.widgets::verbatim_popup_srv( id = "rcode", - verbatim_content = reactive(teal.code::get_code(req(final_q()))), + verbatim_content = reactive(teal.code::get_code(req(decorated_final_q()))), title = "Show R Code for Outlier" ) @@ -1311,7 +1276,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, card$append_text("Comment", "header3") card$append_text(comment) } - card$append_src(teal.code::get_code(req(final_q()))) + card$append_src(teal.code::get_code(req(decorated_final_q()))) card } teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun) From fd80fe69fc31ee85422184fefb76dc87ea29fc51 Mon Sep 17 00:00:00 2001 From: m7pr Date: Mon, 25 Nov 2024 14:01:12 +0100 Subject: [PATCH 4/5] rename plots --- R/tm_outliers.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/tm_outliers.R b/R/tm_outliers.R index 758522be1..211a67086 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -786,7 +786,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, teal.code::eval_code( common_code_q(), substitute( - expr = plot <- plot_call + + expr = box_plot <- plot_call + scale_color_manual(values = c("TRUE" = "red", "FALSE" = "black")) + labs + ggthemes + themes, env = list( @@ -847,7 +847,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, teal.code::eval_code( common_code_q(), substitute( - expr = plot <- plot_call + labs + ggthemes + themes, + expr = density_plot <- plot_call + labs + ggthemes + themes, env = list( plot_call = plot_call, labs = parsed_ggplot2_args$labs, @@ -948,7 +948,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, teal.code::eval_code( qenv, substitute( - expr = plot <- plot_call + + expr = cum_dist_plot <- plot_call + geom_point(data = outlier_points, aes(x = outlier_var_name, y = y, color = is_outlier_selected)) + scale_color_manual(values = c("TRUE" = "red", "FALSE" = "black")) + labs + ggthemes + themes, From da1fa0f542ef6f4126cd68b27564344cf2f93987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Tue, 26 Nov 2024 12:04:14 +0100 Subject: [PATCH 5/5] Update R/tm_outliers.R MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marcin <133694481+m7pr@users.noreply.github.com> Signed-off-by: André Veríssimo <211358+averissimo@users.noreply.github.com> --- R/tm_outliers.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_outliers.R b/R/tm_outliers.R index 211a67086..fdad6693f 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -202,7 +202,7 @@ tm_outliers <- function(label = "Outliers Module", ) ), ui = ui_outliers, - ui_args = c(args), + ui_args = args, datanames = teal.transform::get_extract_datanames(data_extract_list) ) attr(ans, "teal_bookmarkable") <- TRUE