From 4cbc4a538c3a0f2aad808929627e941de254e440 Mon Sep 17 00:00:00 2001 From: vedhav Date: Mon, 16 Oct 2023 19:19:50 +0530 Subject: [PATCH 1/5] chore: replace the qenv function with ggplot2 equivalent --- R/tm_variable_browser.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/tm_variable_browser.R b/R/tm_variable_browser.R index 24eea5744..b0a41a5ef 100644 --- a/R/tm_variable_browser.R +++ b/R/tm_variable_browser.R @@ -485,9 +485,10 @@ srv_variable_browser <- function(id, ) output$variable_summary_table <- DT::renderDataTable({ + browser() var_summary_table( plotted_data()$data, - treat_numeric_as_factor(), + TRUE, input$variable_summary_table_rows, if (!is.null(input$remove_outliers) && input$remove_outliers) { req(input$outlier_definition_slider) @@ -938,7 +939,7 @@ plot_var_summary <- function(var, if (numeric_as_factor) { var <- factor(var, levels = sort(unique(var))) - p <- qplot(var) + ggplot(NULL, aes(x = var)) + geom_histogram(stat = "count") } else { # remove outliers if (outlier_definition != 0) { From f9d09fd5bec0590aafd07ee3e49b2a6b40e03670 Mon Sep 17 00:00:00 2001 From: vedhav Date: Mon, 16 Oct 2023 19:22:40 +0530 Subject: [PATCH 2/5] chore: revert local changes --- R/tm_variable_browser.R | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/R/tm_variable_browser.R b/R/tm_variable_browser.R index b0a41a5ef..5338ec4ef 100644 --- a/R/tm_variable_browser.R +++ b/R/tm_variable_browser.R @@ -485,10 +485,9 @@ srv_variable_browser <- function(id, ) output$variable_summary_table <- DT::renderDataTable({ - browser() var_summary_table( plotted_data()$data, - TRUE, + treat_numeric_as_factor(), input$variable_summary_table_rows, if (!is.null(input$remove_outliers) && input$remove_outliers) { req(input$outlier_definition_slider) From 2f1dff275e2601c376b5071b9b1794b23dc98d98 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 13:55:22 +0000 Subject: [PATCH 3/5] [skip actions] Restyle files --- R/tm_variable_browser.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/tm_variable_browser.R b/R/tm_variable_browser.R index 0b5aaefa3..732e66fae 100644 --- a/R/tm_variable_browser.R +++ b/R/tm_variable_browser.R @@ -940,7 +940,8 @@ plot_var_summary <- function(var, if (numeric_as_factor) { var <- factor(var, levels = sort(unique(var))) - ggplot(NULL, aes(x = var)) + geom_histogram(stat = "count") + ggplot(NULL, aes(x = var)) + + geom_histogram(stat = "count") } else { # remove outliers if (outlier_definition != 0) { From 67c7ca8a45771a9231e3c4ef176a4cb19332f3d6 Mon Sep 17 00:00:00 2001 From: vedhav Date: Mon, 16 Oct 2023 20:55:51 +0530 Subject: [PATCH 4/5] Empty-Commit From 3c426ba02d3f4c0a6698e311bc65b7f87b0ff02d Mon Sep 17 00:00:00 2001 From: vedhav Date: Mon, 16 Oct 2023 20:58:37 +0530 Subject: [PATCH 5/5] chore: simplify the numeric to factor conversion --- R/tm_variable_browser.R | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/R/tm_variable_browser.R b/R/tm_variable_browser.R index 732e66fae..c9887d36f 100644 --- a/R/tm_variable_browser.R +++ b/R/tm_variable_browser.R @@ -500,13 +500,11 @@ srv_variable_browser <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment, label) { - card <- teal::report_card_template( - title = "Variable Browser Plot", - label = label, - with_filter = with_filter, - filter_panel_api = filter_panel_api - ) + card_fun <- function(comment) { + card <- teal::TealReportCard$new() + card$set_name("Variable Browser Plot") + card$append_text("Variable Browser Plot", "header2") + if (with_filter) card$append_fs(filter_panel_api$get_filter_state()) card$append_text("Plot", "header3") card$append_plot(variable_plot_r(), dim = pws$dim()) if (!comment == "") { @@ -939,7 +937,7 @@ plot_var_summary <- function(var, validate(need(!any(is.infinite(var)), "Cannot display graph when data includes infinite values")) if (numeric_as_factor) { - var <- factor(var, levels = sort(unique(var))) + var <- factor(var) ggplot(NULL, aes(x = var)) + geom_histogram(stat = "count") } else {