From 3c426ba02d3f4c0a6698e311bc65b7f87b0ff02d Mon Sep 17 00:00:00 2001 From: vedhav Date: Mon, 16 Oct 2023 20:58:37 +0530 Subject: [PATCH] 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 {