From 31b7b1b5acf6823567db71054e4f803dff7cf214 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Wed, 13 Mar 2024 16:42:09 +0100 Subject: [PATCH 01/31] use restoreInput in updates: tm_g_distribution --- R/tm_g_distribution.R | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index 0044eafdd..7ff133bd4 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -355,6 +355,9 @@ srv_distribution <- function(id, checkmate::assert_class(data, "reactive") checkmate::assert_class(isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { + + ns <- session$ns + rule_req <- function(value) { if (isTRUE(input$dist_tests %in% c( "Fligner-Killeen", @@ -486,7 +489,7 @@ srv_distribution <- function(id, output$scales_types_ui <- renderUI({ if ("group_i" %in% names(selector_list()) && length(selector_list()$group_i()$filters[[1]]$selected) > 0) { shinyWidgets::prettyRadioButtons( - session$ns("scales_type"), + ns("scales_type"), label = "Scales:", choices = c("Fixed", "Free"), selected = "Fixed", @@ -523,11 +526,27 @@ srv_distribution <- function(id, params_vec <- round(unname(unlist(params)), 2) params_names <- names(params) - updateNumericInput(session, "dist_param1", label = params_names[1], value = params_vec[1]) - updateNumericInput(session, "dist_param2", label = params_names[2], value = params_vec[2]) + updateNumericInput( + inputId = "dist_param1", + label = params_names[1], + value = restoreInput(ns("dist_param1"), params_vec[1]) + ) + updateNumericInput( + inputId = "dist_param2", + label = params_names[2], + value = restoreInput(ns("dist_param1"), params_vec[2]) + ) } else { - updateNumericInput(session, "dist_param1", label = "param1", value = NA) - updateNumericInput(session, "dist_param2", label = "param2", value = NA) + updateNumericInput( + inputId = "dist_param1", + label = "param1", + value = restoreInput(ns("dist_param1"), NA) + ) + updateNumericInput( + inputId = "dist_param2", + label = "param2", + value = restoreInput(ns("dist_param2"), NA) + ) } }, ignoreInit = TRUE From f2787ef3c47d2d7fdef70f6f0e7c69a3f4d09e14 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Wed, 13 Mar 2024 16:51:56 +0100 Subject: [PATCH 02/31] use restoreInput in updates: tm_a_regression --- R/tm_a_regression.R | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/R/tm_a_regression.R b/R/tm_a_regression.R index f2e1f8220..a0b323164 100644 --- a/R/tm_a_regression.R +++ b/R/tm_a_regression.R @@ -370,6 +370,9 @@ srv_a_regression <- function(id, checkmate::assert_class(data, "reactive") checkmate::assert_class(isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { + + ns <- session$ns + rule_rvr1 <- function(value) { if (isTRUE(input$plot_type == "Response vs Regressor")) { if (length(value) > 1L) { @@ -472,7 +475,7 @@ srv_a_regression <- function(id, session = session, inputId = "label_var", choices = opts, - selected = selected + selected = restoreInput(ns("label_var"), selected) ) data <- fortify(stats::lm(form, data = ANL)) @@ -484,7 +487,7 @@ srv_a_regression <- function(id, inputId = "outlier", min = 1, max = max_outlier, - value = if (cur_outlier < max_outlier) cur_outlier else max_outlier * .9 + value = restoreInput(ns("outlier"), if (cur_outlier < max_outlier) cur_outlier else max_outlier * .9) ) } From 0bcd71fac70c957aca6d8fb6ea618c2d17cd39ad Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Wed, 13 Mar 2024 16:52:09 +0100 Subject: [PATCH 03/31] use restoreInput in updates: tm_missing_data --- R/tm_missing_data.R | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index 9e5e95229..f717da255 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -171,6 +171,7 @@ srv_page_missing_data <- function(id, data, reporter, filter_panel_api, parent_d is.data.frame(isolate(data())[[name]]) }, datanames) if_subject_plot <- length(parent_dataname) > 0 && parent_dataname %in% datanames + ns <- session$ns output$dataset_tabs <- renderUI({ @@ -416,6 +417,9 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par checkmate::assert_class(data, "reactive") checkmate::assert_class(isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { + + ns <- session$ns + prev_group_by_var <- reactiveVal("") data_r <- reactive(data()[[dataname]]) data_keys <- reactive(unlist(teal.data::join_keys(data())[[dataname]])) @@ -550,7 +554,7 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par selected <- choices <- unname(unlist(choices)) teal.widgets::optionalSelectInput( - session$ns("variables_select"), + ns("variables_select"), label = "Select variables", label_help = HTML(paste0("Dataset: ", tags$code(dataname))), choices = teal.transform::variable_choices(data_r(), choices), @@ -573,7 +577,7 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par session = session, inputId = "variables_select", choices = teal.transform::variable_choices(data_r()), - selected = selected + selected = restoreInput(ns("variables_select"), selected) ) }) @@ -584,7 +588,7 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par need(cat_choices, "Dataset does not have any non-numeric or non-datetime variables to use to group data with") ) teal.widgets::optionalSelectInput( - session$ns("group_by_var"), + ns("group_by_var"), label = "Group by variable", choices = cat_choices, selected = `if`( @@ -625,7 +629,7 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par validate(need(length(choices) < 100, "Please select group-by variable with fewer than 100 unique values")) teal.widgets::optionalSelectInput( - session$ns("group_by_vals"), + ns("group_by_vals"), label = "Filter levels", choices = choices, selected = selected, @@ -872,7 +876,7 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par ) teal.widgets::optionalSliderInputValMinMax( - session$ns("combination_cutoff"), + ns("combination_cutoff"), "Combination cut-off", c(value, range(x)) ) From 0ba693a7b91501e56c45b95f22b9c92c58924e44 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Wed, 13 Mar 2024 16:52:19 +0100 Subject: [PATCH 04/31] use restoreInput in updates: tm_outliers --- R/tm_outliers.R | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/R/tm_outliers.R b/R/tm_outliers.R index e484a4f4c..b3e2f88af 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -331,6 +331,9 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, checkmate::assert_class(data, "reactive") checkmate::assert_class(isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { + + ns <- session$ns + vars <- list(outlier_var = outlier_var, categorical_var = categorical_var) rule_diff <- function(other) { @@ -1064,7 +1067,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, session, inputId = "table_ui_columns", choices = dplyr::setdiff(choices, names(ANL_OUTLIER)), - selected = isolate(input$table_ui_columns) + selected = restoreInput(ns("table_ui_columns"), isolate(input$table_ui_columns)) ) }) @@ -1204,14 +1207,14 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, shiny::req(iv_r()$is_valid()) tagList( teal.widgets::optionalSelectInput( - inputId = session$ns("table_ui_columns"), + inputId = ns("table_ui_columns"), label = "Choose additional columns", choices = NULL, selected = NULL, multiple = TRUE ), h4("Outlier Table"), - teal.widgets::get_dt_rows(session$ns("table_ui"), session$ns("table_ui_rows")) + teal.widgets::get_dt_rows(ns("table_ui"), ns("table_ui_rows")) ) }) From d4a783616c934d8a0f1dfe261d017faeb1d53532 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Fri, 15 Mar 2024 16:07:05 +0100 Subject: [PATCH 05/31] all tabsetPanel have id --- R/tm_data_table.R | 67 +++++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/R/tm_data_table.R b/R/tm_data_table.R index f5dcbf072..98e0a4fd4 100644 --- a/R/tm_data_table.R +++ b/R/tm_data_table.R @@ -196,41 +196,44 @@ srv_page_data_table <- function(id, output$dataset_table <- renderUI({ do.call( tabsetPanel, - lapply( - datanames, - function(x) { - dataset <- isolate(data()[[x]]) - choices <- names(dataset) - labels <- vapply( - dataset, - function(x) ifelse(is.null(attr(x, "label")), "", attr(x, "label")), - character(1) - ) - names(choices) <- ifelse( - is.na(labels) | labels == "", - choices, - paste(choices, labels, sep = ": ") - ) - variables_selected <- if (!is.null(variables_selected[[x]])) { - variables_selected[[x]] - } else { - utils::head(choices) - } - tabPanel( - title = x, - column( - width = 12, - tags$div( - class = "mt-4", - ui_data_table( - id = session$ns(x), - choices = choices, - selected = variables_selected + c( + list(id = session$ns("dataname_tab")), + lapply( + datanames, + function(x) { + dataset <- isolate(data()[[x]]) + choices <- names(dataset) + labels <- vapply( + dataset, + function(x) ifelse(is.null(attr(x, "label")), "", attr(x, "label")), + character(1) + ) + names(choices) <- ifelse( + is.na(labels) | labels == "", + choices, + paste(choices, labels, sep = ": ") + ) + variables_selected <- if (!is.null(variables_selected[[x]])) { + variables_selected[[x]] + } else { + utils::head(choices) + } + tabPanel( + title = x, + column( + width = 12, + div( + class = "mt-4", + ui_data_table( + id = session$ns(x), + choices = choices, + selected = variables_selected + ) ) ) ) - ) - } + } + ) ) ) }) From 1249e727d00eef41594978dc81006249eb754abf Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Mar 2024 15:11:28 +0000 Subject: [PATCH 06/31] [skip style] [skip vbump] Restyle files --- R/tm_a_regression.R | 1 - R/tm_g_distribution.R | 1 - R/tm_missing_data.R | 1 - R/tm_outliers.R | 1 - 4 files changed, 4 deletions(-) diff --git a/R/tm_a_regression.R b/R/tm_a_regression.R index 8972d37e2..722210a05 100644 --- a/R/tm_a_regression.R +++ b/R/tm_a_regression.R @@ -370,7 +370,6 @@ srv_a_regression <- function(id, checkmate::assert_class(data, "reactive") checkmate::assert_class(isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { - ns <- session$ns rule_rvr1 <- function(value) { diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index 0285860d2..050577bd8 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -355,7 +355,6 @@ srv_distribution <- function(id, checkmate::assert_class(data, "reactive") checkmate::assert_class(isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { - ns <- session$ns rule_req <- function(value) { diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index 281202a8e..9bdc844c2 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -417,7 +417,6 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par checkmate::assert_class(data, "reactive") checkmate::assert_class(isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { - ns <- session$ns prev_group_by_var <- reactiveVal("") diff --git a/R/tm_outliers.R b/R/tm_outliers.R index f2a3839c8..e0ae5c99e 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -331,7 +331,6 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, checkmate::assert_class(data, "reactive") checkmate::assert_class(isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { - ns <- session$ns vars <- list(outlier_var = outlier_var, categorical_var = categorical_var) From 5c922f91af69acb784d8656d68ab0b3088dac330 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Fri, 15 Mar 2024 18:28:19 +0100 Subject: [PATCH 07/31] trigger From efea9d5049293cce1b6f7c71e64dd20e036b1f92 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Thu, 21 Mar 2024 16:09:43 +0100 Subject: [PATCH 08/31] simplify logic in tm_g_distribution --- R/tm_g_distribution.R | 67 +++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 38 deletions(-) diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index d60cc786a..faaa6ca00 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -505,48 +505,39 @@ srv_distribution <- function(id, selector_list()$dist_i()$select ), handlerExpr = { - if (length(input$t_dist) != 0) { - dist_var2 <- as.vector(merged$anl_input_r()$columns_source$dist_i) - - get_dist_params <- function(x, dist) { - if (dist == "unif") { - res <- as.list(range(x)) - names(res) <- c("min", "max") - return(res) + params <- + if (length(input$t_dist) != 0) { + dist_var2 <- as.vector(merged$anl_input_r()$columns_source$dist_i) + + get_dist_params <- function(x, dist) { + if (dist == "unif") { + return(stats::setNames(range(x, na.rm = TRUE), c("min", "max"))) + } + tryCatch( + MASS::fitdistr(x, densfun = dist)$estimate, + error = function(e) c(param1 = NA_real_, param2 = NA_real_) + ) } - tryCatch( - as.list(MASS::fitdistr(x, densfun = dist)$estimate), - error = function(e) list(param1 = NA, param2 = NA) - ) + + ANL <- merged$anl_q_r()[[as.character(dist_var[[1]]$dataname)]] + round(get_dist_params(as.numeric(stats::na.omit(ANL[[dist_var2]])), input$t_dist), 2) + } else { + c("param1" = NA_real_, "param2" = NA_real_) } - ANL <- merged$anl_q_r()[[as.character(dist_var[[1]]$dataname)]] - params <- get_dist_params(as.numeric(stats::na.omit(ANL[[dist_var2]])), input$t_dist) - params_vec <- round(unname(unlist(params)), 2) - params_names <- names(params) + params_vals <- unname(params) + params_names <- names(params) - updateNumericInput( - inputId = "dist_param1", - label = params_names[1], - value = restoreInput(ns("dist_param1"), params_vec[1]) - ) - updateNumericInput( - inputId = "dist_param2", - label = params_names[2], - value = restoreInput(ns("dist_param1"), params_vec[2]) - ) - } else { - updateNumericInput( - inputId = "dist_param1", - label = "param1", - value = restoreInput(ns("dist_param1"), NA) - ) - updateNumericInput( - inputId = "dist_param2", - label = "param2", - value = restoreInput(ns("dist_param2"), NA) - ) - } + updateNumericInput( + inputId = "dist_param1", + label = params_names[1], + value = restoreInput(ns("dist_param1"), params_vals[1]) + ) + updateNumericInput( + inputId = "dist_param2", + label = params_names[2], + value = restoreInput(ns("dist_param1"), params_vals[2]) + ) }, ignoreInit = TRUE ) From 63b8d8413bbb058f455843037cd4398c3ea3a39b Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Thu, 21 Mar 2024 23:15:22 +0100 Subject: [PATCH 09/31] modify dist params logic to allow bookmarking --- R/tm_g_distribution.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index faaa6ca00..6625c65ce 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -291,7 +291,7 @@ ui_distribution <- function(id, ...) { ), numericInput(ns("dist_param1"), label = "param1", value = NULL), numericInput(ns("dist_param2"), label = "param2", value = NULL), - tags$span(actionButton(ns("params_reset"), "Reset params")), + tags$span(actionButton(ns("params_reset"), "Default params")), collapsed = FALSE ) ) @@ -505,6 +505,7 @@ srv_distribution <- function(id, selector_list()$dist_i()$select ), handlerExpr = { + req(input$params_reset) params <- if (length(input$t_dist) != 0) { dist_var2 <- as.vector(merged$anl_input_r()$columns_source$dist_i) @@ -542,6 +543,10 @@ srv_distribution <- function(id, ignoreInit = TRUE ) + observeEvent(input$params_reset, { + updateActionButton(inputId = "params_reset", label = "Reset params") + }) + merge_vars <- reactive({ teal::validate_inputs(iv_r()) From 605a2562c89a23989e782197b0a80e72a38f6905 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 12:54:17 +0100 Subject: [PATCH 10/31] introduce teal_bookmarkable attribute in modules --- R/tm_a_pca.R | 4 +++- R/tm_a_regression.R | 4 +++- R/tm_data_table.R | 4 +++- R/tm_file_viewer.R | 4 +++- R/tm_front_page.R | 6 +++++- R/tm_g_association.R | 4 +++- R/tm_g_bivariate.R | 4 +++- R/tm_g_distribution.R | 4 +++- R/tm_g_response.R | 4 +++- R/tm_g_scatterplot.R | 4 +++- R/tm_g_scatterplotmatrix.R | 4 +++- R/tm_missing_data.R | 4 +++- R/tm_outliers.R | 4 +++- R/tm_t_crosstable.R | 4 +++- R/tm_variable_browser.R | 4 +++- 15 files changed, 47 insertions(+), 15 deletions(-) diff --git a/R/tm_a_pca.R b/R/tm_a_pca.R index 7360ea2bc..a4867c010 100644 --- a/R/tm_a_pca.R +++ b/R/tm_a_pca.R @@ -161,7 +161,7 @@ tm_a_pca <- function(label = "Principal Component Analysis", data_extract_list <- list(dat = dat) - module( + ans <- module( label = label, server = srv_a_pca, ui = ui_a_pca, @@ -176,6 +176,8 @@ tm_a_pca <- function(label = "Principal Component Analysis", ), datanames = teal.transform::get_extract_datanames(data_extract_list) ) + attr(ans, "teal_bookmarkable") <- NULL + ans } # UI function for the PCA module diff --git a/R/tm_a_regression.R b/R/tm_a_regression.R index 9c0b836cb..91db81568 100644 --- a/R/tm_a_regression.R +++ b/R/tm_a_regression.R @@ -225,7 +225,7 @@ tm_a_regression <- function(label = "Regression Analysis", response = response ) - module( + nas <- module( label = label, server = srv_a_regression, ui = ui_a_regression, @@ -241,6 +241,8 @@ tm_a_regression <- function(label = "Regression Analysis", ), datanames = teal.transform::get_extract_datanames(data_extract_list) ) + attr(ans, "teal_bookmarkable") <- TRUE + ans } # UI function for the regression module diff --git a/R/tm_data_table.R b/R/tm_data_table.R index e2ad6284e..637453f2b 100644 --- a/R/tm_data_table.R +++ b/R/tm_data_table.R @@ -116,7 +116,7 @@ tm_data_table <- function(label = "Data Table", checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) # End of assertions - module( + ans <- module( label, server = srv_page_data_table, ui = ui_page_data_table, @@ -133,6 +133,8 @@ tm_data_table <- function(label = "Data Table", post_output = post_output ) ) + attr(ans, "teal_bookmarkable") <- TRUE + ans } # UI page module diff --git a/R/tm_file_viewer.R b/R/tm_file_viewer.R index dbf9f3674..6bb2154e2 100644 --- a/R/tm_file_viewer.R +++ b/R/tm_file_viewer.R @@ -82,7 +82,7 @@ tm_file_viewer <- function(label = "File Viewer Module", # Make UI args args <- as.list(environment()) - module( + ans <- module( label = label, server = srv_viewer, server_args = list(input_path = input_path), @@ -90,6 +90,8 @@ tm_file_viewer <- function(label = "File Viewer Module", ui_args = args, datanames = NULL ) + attr(ans, "teal_bookmarkable") <- NULL + ans } # UI function for the file viewer module diff --git a/R/tm_front_page.R b/R/tm_front_page.R index 7d5c02f04..ffaf319e4 100644 --- a/R/tm_front_page.R +++ b/R/tm_front_page.R @@ -81,7 +81,7 @@ tm_front_page <- function(label = "Front page", # Make UI args args <- as.list(environment()) - module( + ans <- module( label = label, server = srv_front_page, ui = ui_front_page, @@ -89,6 +89,8 @@ tm_front_page <- function(label = "Front page", server_args = list(tables = tables, show_metadata = show_metadata), datanames = if (show_metadata) "all" else NULL ) + attr(ans, "teal_bookmarkable") <- NULL + ans } # UI function for the front page module @@ -128,6 +130,8 @@ ui_front_page <- function(id, ...) { ) ) ) + attr(ans, "teal_bookmarkable") <- NULL + ans } # Server function for the front page module diff --git a/R/tm_g_association.R b/R/tm_g_association.R index 5eeca0240..d9fd1f725 100644 --- a/R/tm_g_association.R +++ b/R/tm_g_association.R @@ -177,7 +177,7 @@ tm_g_association <- function(label = "Association", vars = vars ) - module( + ans <- module( label = label, server = srv_tm_g_association, ui = ui_tm_g_association, @@ -188,6 +188,8 @@ tm_g_association <- function(label = "Association", ), datanames = teal.transform::get_extract_datanames(data_extract_list) ) + attr(ans, "teal_bookmarkable") <- NULL + ans } # UI function for the association module diff --git a/R/tm_g_bivariate.R b/R/tm_g_bivariate.R index 7e67adcbb..e5306a8df 100644 --- a/R/tm_g_bivariate.R +++ b/R/tm_g_bivariate.R @@ -288,7 +288,7 @@ tm_g_bivariate <- function(label = "Bivariate Plots", size = size ) - module( + ans <- module( label = label, server = srv_g_bivariate, ui = ui_g_bivariate, @@ -299,6 +299,8 @@ tm_g_bivariate <- function(label = "Bivariate Plots", ), datanames = teal.transform::get_extract_datanames(data_extract_list) ) + attr(ans, "teal_bookmarkable") <- NULL + ans } # UI function for the bivariate module diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index 6625c65ce..50630b10e 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -180,7 +180,7 @@ tm_g_distribution <- function(label = "Distribution Module", group_var = group_var ) - module( + ans <- module( label = label, server = srv_distribution, server_args = c( @@ -191,6 +191,8 @@ tm_g_distribution <- function(label = "Distribution Module", ui_args = args, datanames = teal.transform::get_extract_datanames(data_extract_list) ) + attr(ans, "teal_bookmarkable") <- TRUE + ans } # UI function for the distribution module diff --git a/R/tm_g_response.R b/R/tm_g_response.R index dc2250b1a..2bb941eab 100644 --- a/R/tm_g_response.R +++ b/R/tm_g_response.R @@ -206,7 +206,7 @@ tm_g_response <- function(label = "Response Plot", col_facet = col_facet ) - module( + ans <- module( label = label, server = srv_g_response, ui = ui_g_response, @@ -217,6 +217,8 @@ tm_g_response <- function(label = "Response Plot", ), datanames = teal.transform::get_extract_datanames(data_extract_list) ) + attr(ans, "teal_bookmarkable") <- NULL + ans } # UI function for the response module diff --git a/R/tm_g_scatterplot.R b/R/tm_g_scatterplot.R index 65dd295ec..5091cb9a5 100644 --- a/R/tm_g_scatterplot.R +++ b/R/tm_g_scatterplot.R @@ -308,7 +308,7 @@ tm_g_scatterplot <- function(label = "Scatterplot", col_facet = col_facet ) - module( + ans <- module( label = label, server = srv_g_scatterplot, ui = ui_g_scatterplot, @@ -319,6 +319,8 @@ tm_g_scatterplot <- function(label = "Scatterplot", ), datanames = teal.transform::get_extract_datanames(data_extract_list) ) + attr(ans, "teal_bookmarkable") <- NULL + ans } # UI function for the scatterplot module diff --git a/R/tm_g_scatterplotmatrix.R b/R/tm_g_scatterplotmatrix.R index 1020eaa3f..7108c9be4 100644 --- a/R/tm_g_scatterplotmatrix.R +++ b/R/tm_g_scatterplotmatrix.R @@ -191,7 +191,7 @@ tm_g_scatterplotmatrix <- function(label = "Scatterplot Matrix", # Make UI args args <- as.list(environment()) - module( + ans <- module( label = label, server = srv_g_scatterplotmatrix, ui = ui_g_scatterplotmatrix, @@ -199,6 +199,8 @@ tm_g_scatterplotmatrix <- function(label = "Scatterplot Matrix", server_args = list(variables = variables, plot_height = plot_height, plot_width = plot_width), datanames = teal.transform::get_extract_datanames(variables) ) + attr(ans, "teal_bookmarkable") <- NULL + ans } # UI function for the scatterplot matrix module diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index c558aa887..f603bddf9 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -124,7 +124,7 @@ tm_missing_data <- function(label = "Missing data", checkmate::assert_multi_class(post_output, c("shiny.tag", "shiny.tag.list", "html"), null.ok = TRUE) # End of assertions - module( + ans <- module( label, server = srv_page_missing_data, server_args = list( @@ -135,6 +135,8 @@ tm_missing_data <- function(label = "Missing data", datanames = "all", ui_args = list(pre_output = pre_output, post_output = post_output) ) + attr(ans, "teal_bookmarkable") <- TRUE + ans } # UI function for the missing data module (all datasets) diff --git a/R/tm_outliers.R b/R/tm_outliers.R index a91a24bb0..834ca7d36 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -177,7 +177,7 @@ tm_outliers <- function(label = "Outliers Module", categorical_var = categorical_var ) - module( + ans <- module( label = label, server = srv_outliers, server_args = c( @@ -188,6 +188,8 @@ tm_outliers <- function(label = "Outliers Module", ui_args = args, datanames = teal.transform::get_extract_datanames(data_extract_list) ) + attr(ans, "teal_bookmarkable") <- FALSE + ans } # UI function for the outliers module diff --git a/R/tm_t_crosstable.R b/R/tm_t_crosstable.R index 5adc366e9..168f4695c 100644 --- a/R/tm_t_crosstable.R +++ b/R/tm_t_crosstable.R @@ -173,7 +173,7 @@ tm_t_crosstable <- function(label = "Cross Table", basic_table_args = basic_table_args ) - module( + ans <- module( label = label, server = srv_t_crosstable, ui = ui_t_crosstable, @@ -181,6 +181,8 @@ tm_t_crosstable <- function(label = "Cross Table", server_args = server_args, datanames = teal.transform::get_extract_datanames(list(x = x, y = y)) ) + attr(ans, "teal_bookmarkable") <- NULL + ans } # UI function for the cross-table module diff --git a/R/tm_variable_browser.R b/R/tm_variable_browser.R index 283a48855..7fc12fcef 100644 --- a/R/tm_variable_browser.R +++ b/R/tm_variable_browser.R @@ -100,7 +100,7 @@ tm_variable_browser <- function(label = "Variable Browser", datasets_selected <- unique(datasets_selected) - module( + ans <- module( label, server = srv_variable_browser, ui = ui_variable_browser, @@ -115,6 +115,8 @@ tm_variable_browser <- function(label = "Variable Browser", post_output = post_output ) ) + attr(ans, "teal_bookmarkable") <- NULL + ans } # UI function for the variable browser module From ebf6fb755c38557cce65c08411d426c2fa61b0b2 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 12:55:01 +0100 Subject: [PATCH 11/31] break lines --- R/tm_a_pca.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/tm_a_pca.R b/R/tm_a_pca.R index a4867c010..a639965c2 100644 --- a/R/tm_a_pca.R +++ b/R/tm_a_pca.R @@ -755,7 +755,11 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl dev_labs <- list(color = varname_w_label(resp_col, ANL)) scales_biplot <- - if (is.character(response) || is.factor(response) || (is.numeric(response) && length(unique(response)) <= 6)) { # nolint: line_length. + if ( + is.character(response) || + is.factor(response) || + (is.numeric(response) && length(unique(response)) <= 6) + ) { qenv <- teal.code::eval_code( qenv, quote(pca_rot$response <- as.factor(response)) From 245f0c67a37dfff4f82f08fd2d9bb92e85ddf8d2 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 12:56:03 +0100 Subject: [PATCH 12/31] clean up --- R/tm_front_page.R | 2 -- 1 file changed, 2 deletions(-) diff --git a/R/tm_front_page.R b/R/tm_front_page.R index ffaf319e4..4702a6e33 100644 --- a/R/tm_front_page.R +++ b/R/tm_front_page.R @@ -130,8 +130,6 @@ ui_front_page <- function(id, ...) { ) ) ) - attr(ans, "teal_bookmarkable") <- NULL - ans } # Server function for the front page module From b6da99367ab9124bb948f27f9b31062096e23e83 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 13:09:45 +0100 Subject: [PATCH 13/31] module bookmarkable: tm_t_frontpage --- R/tm_front_page.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/tm_front_page.R b/R/tm_front_page.R index 4702a6e33..45bde2fe7 100644 --- a/R/tm_front_page.R +++ b/R/tm_front_page.R @@ -89,7 +89,7 @@ tm_front_page <- function(label = "Front page", server_args = list(tables = tables, show_metadata = show_metadata), datanames = if (show_metadata) "all" else NULL ) - attr(ans, "teal_bookmarkable") <- NULL + attr(ans, "teal_bookmarkable") <- TRUE ans } @@ -139,6 +139,8 @@ srv_front_page <- function(id, data, tables, show_metadata) { moduleServer(id, function(input, output, session) { ns <- session$ns + setBookmarkExclude("metadata_button") + lapply(seq_along(tables), function(idx) { output[[paste0("table_", idx)]] <- renderTable( tables[[idx]], From f1600ef9f328903e7a3ee16f8c20a3e6f31b35b8 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 13:10:00 +0100 Subject: [PATCH 14/31] module bookmarkable: tm_g_bivariate --- R/tm_g_bivariate.R | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/R/tm_g_bivariate.R b/R/tm_g_bivariate.R index e5306a8df..7c3fa8ee6 100644 --- a/R/tm_g_bivariate.R +++ b/R/tm_g_bivariate.R @@ -299,7 +299,7 @@ tm_g_bivariate <- function(label = "Bivariate Plots", ), datanames = teal.transform::get_extract_datanames(data_extract_list) ) - attr(ans, "teal_bookmarkable") <- NULL + attr(ans, "teal_bookmarkable") <- TRUE ans } @@ -465,6 +465,8 @@ srv_g_bivariate <- function(id, checkmate::assert_class(data, "reactive") checkmate::assert_class(isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { + ns <- session$ns + data_extract <- list( x = x, y = y, row_facet = row_facet, col_facet = col_facet, color = color, fill = fill, size = size @@ -588,7 +590,7 @@ srv_g_bivariate <- function(id, } } else { shinyjs::hide("add_lines") - updateCheckboxInput(session, "add_lines", value = FALSE) + updateCheckboxInput(session, "add_lines", value = restoreInput(ns("add_lines"), FALSE)) shinyjs::hide("alpha") shinyjs::hide("fixed_size") shinyjs::hide("size_settings") From cde83e25137b9a7eec9d5fc493ddd50eaf9adc8c Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 13:10:15 +0100 Subject: [PATCH 15/31] module bookmarkable: tm_variable_browser --- R/tm_variable_browser.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/tm_variable_browser.R b/R/tm_variable_browser.R index 7fc12fcef..591137ccb 100644 --- a/R/tm_variable_browser.R +++ b/R/tm_variable_browser.R @@ -115,6 +115,7 @@ tm_variable_browser <- function(label = "Variable Browser", post_output = post_output ) ) + # `shiny` inputs are stored properly but the majority of the module is state of `datatable` which is not stored. attr(ans, "teal_bookmarkable") <- NULL ans } From ea841f84be4fd930df6b7f82a4609e33ba92c834 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 13:20:57 +0100 Subject: [PATCH 16/31] module bookmarkable: tm_file_viewer --- R/tm_file_viewer.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_file_viewer.R b/R/tm_file_viewer.R index 6bb2154e2..8564cf6ab 100644 --- a/R/tm_file_viewer.R +++ b/R/tm_file_viewer.R @@ -90,7 +90,7 @@ tm_file_viewer <- function(label = "File Viewer Module", ui_args = args, datanames = NULL ) - attr(ans, "teal_bookmarkable") <- NULL + attr(ans, "teal_bookmarkable") <- FALSE ans } From 303c7876f0dc61118e5be2d2da95ee8db43e9966 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 13:23:11 +0100 Subject: [PATCH 17/31] module bookmarkable: tm_g_association --- R/tm_g_association.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_g_association.R b/R/tm_g_association.R index d9fd1f725..ae1ccebe6 100644 --- a/R/tm_g_association.R +++ b/R/tm_g_association.R @@ -188,7 +188,7 @@ tm_g_association <- function(label = "Association", ), datanames = teal.transform::get_extract_datanames(data_extract_list) ) - attr(ans, "teal_bookmarkable") <- NULL + attr(ans, "teal_bookmarkable") <- TRUE ans } From 717595bd8027792dad40f699ffb21d28eba301a9 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 13:26:04 +0100 Subject: [PATCH 18/31] module bookmarkable: tm_g_response --- R/tm_g_response.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_g_response.R b/R/tm_g_response.R index 2bb941eab..980994f54 100644 --- a/R/tm_g_response.R +++ b/R/tm_g_response.R @@ -217,7 +217,7 @@ tm_g_response <- function(label = "Response Plot", ), datanames = teal.transform::get_extract_datanames(data_extract_list) ) - attr(ans, "teal_bookmarkable") <- NULL + attr(ans, "teal_bookmarkable") <- TRUE ans } From f5c1c2d3fb0620f459b2240f5349c70d51958d52 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 13:30:21 +0100 Subject: [PATCH 19/31] module bookmarkable: tm_g_scatterplot --- R/tm_g_scatterplot.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_g_scatterplot.R b/R/tm_g_scatterplot.R index 5091cb9a5..e1ee34d10 100644 --- a/R/tm_g_scatterplot.R +++ b/R/tm_g_scatterplot.R @@ -319,7 +319,7 @@ tm_g_scatterplot <- function(label = "Scatterplot", ), datanames = teal.transform::get_extract_datanames(data_extract_list) ) - attr(ans, "teal_bookmarkable") <- NULL + attr(ans, "teal_bookmarkable") <- TRUE ans } From 5383d5ceb950bad1133490d6681427b4a53a1c2f Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 13:33:56 +0100 Subject: [PATCH 20/31] module bookmarkable: tm_g_scatterplotmatrix --- R/tm_g_scatterplotmatrix.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_g_scatterplotmatrix.R b/R/tm_g_scatterplotmatrix.R index 7108c9be4..ef329c3d7 100644 --- a/R/tm_g_scatterplotmatrix.R +++ b/R/tm_g_scatterplotmatrix.R @@ -199,7 +199,7 @@ tm_g_scatterplotmatrix <- function(label = "Scatterplot Matrix", server_args = list(variables = variables, plot_height = plot_height, plot_width = plot_width), datanames = teal.transform::get_extract_datanames(variables) ) - attr(ans, "teal_bookmarkable") <- NULL + attr(ans, "teal_bookmarkable") <- TRUE ans } From 4af39e32a528eff0fb873f8670074916e7f7a04f Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 13:35:36 +0100 Subject: [PATCH 21/31] module bookmarkable: tm_t_crosstable --- R/tm_t_crosstable.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_t_crosstable.R b/R/tm_t_crosstable.R index 168f4695c..61f236df4 100644 --- a/R/tm_t_crosstable.R +++ b/R/tm_t_crosstable.R @@ -181,7 +181,7 @@ tm_t_crosstable <- function(label = "Cross Table", server_args = server_args, datanames = teal.transform::get_extract_datanames(list(x = x, y = y)) ) - attr(ans, "teal_bookmarkable") <- NULL + attr(ans, "teal_bookmarkable") <- TRUE ans } From 61cef675ea6025dc40ec0a4ec0ea6b6e015700c1 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 25 Mar 2024 12:56:39 +0000 Subject: [PATCH 22/31] [skip style] [skip vbump] Restyle files --- R/tm_a_pca.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/tm_a_pca.R b/R/tm_a_pca.R index a639965c2..990bf1cba 100644 --- a/R/tm_a_pca.R +++ b/R/tm_a_pca.R @@ -757,8 +757,8 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl scales_biplot <- if ( is.character(response) || - is.factor(response) || - (is.numeric(response) && length(unique(response)) <= 6) + is.factor(response) || + (is.numeric(response) && length(unique(response)) <= 6) ) { qenv <- teal.code::eval_code( qenv, From b191ed17b0fc05cb17e47639f5039c3f185c74b5 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 14:04:31 +0100 Subject: [PATCH 23/31] fix erroneous bookmarkable flags --- R/tm_a_regression.R | 2 +- R/tm_outliers.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/tm_a_regression.R b/R/tm_a_regression.R index 91db81568..72a051874 100644 --- a/R/tm_a_regression.R +++ b/R/tm_a_regression.R @@ -241,7 +241,7 @@ tm_a_regression <- function(label = "Regression Analysis", ), datanames = teal.transform::get_extract_datanames(data_extract_list) ) - attr(ans, "teal_bookmarkable") <- TRUE + attr(ans, "teal_bookmarkable") <- FALSE ans } diff --git a/R/tm_outliers.R b/R/tm_outliers.R index 834ca7d36..bcbc46772 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -188,7 +188,7 @@ tm_outliers <- function(label = "Outliers Module", ui_args = args, datanames = teal.transform::get_extract_datanames(data_extract_list) ) - attr(ans, "teal_bookmarkable") <- FALSE + attr(ans, "teal_bookmarkable") <- NULL ans } From 5473cf4ee47b391db58c24074201dcf224871444 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 14:08:01 +0100 Subject: [PATCH 24/31] module bookmarkable: tm_outliers --- 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 bcbc46772..7f1c0adbd 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -188,7 +188,7 @@ tm_outliers <- function(label = "Outliers Module", ui_args = args, datanames = teal.transform::get_extract_datanames(data_extract_list) ) - attr(ans, "teal_bookmarkable") <- NULL + attr(ans, "teal_bookmarkable") <- TRUE ans } From 76daa5d8f2c3f93fda8c7c67669430d87c2e18d5 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 14:21:25 +0100 Subject: [PATCH 25/31] fix linter --- .lintr | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.lintr b/.lintr index b2279e658..113ca30c1 100644 --- a/.lintr +++ b/.lintr @@ -2,5 +2,6 @@ linters: linters_with_defaults( line_length_linter = line_length_linter(120), cyclocomp_linter = NULL, object_usage_linter = NULL, - object_name_linter = object_name_linter(styles = c("snake_case", "symbols"), regexes = c(ANL = "^ANL_?[0-9A-Z_]*$", ADaM = "^r?AD[A-Z]{2,3}_?[0-9]*$")) + object_name_linter = object_name_linter(styles = c("snake_case", "symbols"), regexes = c(ANL = "^ANL_?[0-9A-Z_]*$", ADaM = "^r?AD[A-Z]{2,3}_?[0-9]*$")), + indentation_linter = NULL ) From 41dba6839c5c0082e7bb72baaae8fbbf74d4a7ea Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 14:23:26 +0100 Subject: [PATCH 26/31] remove erroneous bookmarkable flag --- R/tm_missing_data.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index f603bddf9..1eda9fd84 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -135,7 +135,7 @@ tm_missing_data <- function(label = "Missing data", datanames = "all", ui_args = list(pre_output = pre_output, post_output = post_output) ) - attr(ans, "teal_bookmarkable") <- TRUE + attr(ans, "teal_bookmarkable") <- NULL ans } From 3292ba54bc8ef4da1cc2cf684b2166e196098014 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 14:30:58 +0100 Subject: [PATCH 27/31] module bookmarkable: tm_missing_data --- R/tm_missing_data.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index 1eda9fd84..f603bddf9 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -135,7 +135,7 @@ tm_missing_data <- function(label = "Missing data", datanames = "all", ui_args = list(pre_output = pre_output, post_output = post_output) ) - attr(ans, "teal_bookmarkable") <- NULL + attr(ans, "teal_bookmarkable") <- TRUE ans } From d866adc141f25ee32088cba0238df86dc7537fdc Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 14:33:42 +0100 Subject: [PATCH 28/31] fix typo --- R/tm_a_regression.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_a_regression.R b/R/tm_a_regression.R index 72a051874..d276aaa2d 100644 --- a/R/tm_a_regression.R +++ b/R/tm_a_regression.R @@ -225,7 +225,7 @@ tm_a_regression <- function(label = "Regression Analysis", response = response ) - nas <- module( + ans <- module( label = label, server = srv_a_regression, ui = ui_a_regression, From 43011fcd9632d87b973b7c45df203349acc37347 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 14:46:29 +0100 Subject: [PATCH 29/31] module bookmarkable: tm_a_pca --- R/tm_a_pca.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_a_pca.R b/R/tm_a_pca.R index 990bf1cba..42261b2f0 100644 --- a/R/tm_a_pca.R +++ b/R/tm_a_pca.R @@ -176,7 +176,7 @@ tm_a_pca <- function(label = "Principal Component Analysis", ), datanames = teal.transform::get_extract_datanames(data_extract_list) ) - attr(ans, "teal_bookmarkable") <- NULL + attr(ans, "teal_bookmarkable") <- FALSE ans } From 4b17fd166248fd16837f20a9d4171a201b3da39c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Ka=C5=82=C4=99dkowski?= Date: Tue, 26 Mar 2024 15:01:18 +0100 Subject: [PATCH 30/31] fix error --- R/tm_data_table.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_data_table.R b/R/tm_data_table.R index 637453f2b..db9f42681 100644 --- a/R/tm_data_table.R +++ b/R/tm_data_table.R @@ -301,7 +301,7 @@ srv_data_table <- function(id, iv <- shinyvalidate::InputValidator$new() iv$add_rule("variables", shinyvalidate::sv_required("Please select valid variable names")) iv$add_rule("variables", shinyvalidate::sv_in_set( - set = names(data()[[dataname]]), message_fmt = "Not all selected variables exist in the data" + set = names(isolate(data())[[dataname]]), message_fmt = "Not all selected variables exist in the data" )) iv$enable() From 9623d52ddb95a4f22837099ca746ee2539bd46b6 Mon Sep 17 00:00:00 2001 From: gogonzo Date: Wed, 27 Mar 2024 11:30:27 +0100 Subject: [PATCH 31/31] fixes --- R/tm_missing_data.R | 6 ++++-- R/tm_outliers.R | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index f603bddf9..12eb6835f 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -167,6 +167,8 @@ ui_page_missing_data <- function(id, pre_output = NULL, post_output = NULL) { # Server function for the missing data module (all datasets) srv_page_missing_data <- function(id, data, reporter, filter_panel_api, parent_dataname, plot_height, plot_width, ggplot2_args, ggtheme) { + with_reporter <- !missing(reporter) && inherits(reporter, "Reporter") + with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI") moduleServer(id, function(input, output, session) { datanames <- isolate(teal.data::datanames(data())) datanames <- Filter(function(name) { @@ -239,8 +241,8 @@ srv_page_missing_data <- function(id, data, reporter, filter_panel_api, parent_d srv_missing_data( id = x, data = data, - reporter = reporter, - filter_panel_api = filter_panel_api, + reporter = if (with_reporter) reporter, + filter_panel_api = if (with_filter) filter_panel_api, dataname = x, parent_dataname = parent_dataname, plot_height = plot_height, diff --git a/R/tm_outliers.R b/R/tm_outliers.R index 7f1c0adbd..84b323008 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -1060,14 +1060,14 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, brushing = TRUE ) - choices <- teal.transform::variable_choices(data()[[dataname_first]]) + choices <- reactive(teal.transform::variable_choices(data()[[dataname_first]])) observeEvent(common_code_q(), { ANL_OUTLIER <- common_code_q()[["ANL_OUTLIER"]] teal.widgets::updateOptionalSelectInput( session, inputId = "table_ui_columns", - choices = dplyr::setdiff(choices, names(ANL_OUTLIER)), + choices = dplyr::setdiff(choices(), names(ANL_OUTLIER)), selected = restoreInput(ns("table_ui_columns"), isolate(input$table_ui_columns)) ) })