diff --git a/R/tm_g_gh_boxplot.R b/R/tm_g_gh_boxplot.R index c44180ef..9ba8989a 100644 --- a/R/tm_g_gh_boxplot.R +++ b/R/tm_g_gh_boxplot.R @@ -456,6 +456,7 @@ srv_g_boxplot <- function(id, font_size = .(font_size), unit = .("AVALU") ) + print(p) }) ) }), 800) @@ -479,6 +480,7 @@ srv_g_boxplot <- function(id, xaxis_var = .(xaxis_var), facet_var = .(facet_var) ) + tbl }) ) }), 800) @@ -507,6 +509,13 @@ srv_g_boxplot <- function(id, DT::formatRound(numeric_cols, 4) }) + joined_qenvs <- reactive({ + req(create_plot(), create_table()) + teal.code::join(create_plot(), create_table()) + }) + + code <- reactive(teal.code::get_code(joined_qenvs())) + ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { @@ -535,11 +544,7 @@ srv_g_boxplot <- function(id, card$append_text("Comment", "header3") card$append_text(comment) } - card$append_src( - teal.code::get_code( - teal.code::join(create_plot(), create_table()) - ) - ) + card$append_src(code()) card } teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun) @@ -578,14 +583,9 @@ srv_g_boxplot <- function(id, DT::formatRound(numeric_cols, 4) }) - joined_qenvs <- reactive({ - req(create_plot(), create_table()) - teal.code::join(create_plot(), create_table()) - }) - teal.widgets::verbatim_popup_srv( id = "rcode", - verbatim_content = reactive(teal.code::get_code(joined_qenvs())), + verbatim_content = reactive(code()), title = "Show R Code for Boxplot" ) }) diff --git a/R/tm_g_gh_correlationplot.R b/R/tm_g_gh_correlationplot.R index 773102d1..a352ec01 100644 --- a/R/tm_g_gh_correlationplot.R +++ b/R/tm_g_gh_correlationplot.R @@ -821,6 +821,7 @@ srv_g_correlationplot <- function(id, brushing = TRUE ) + code <- reactive(teal.code::get_code(plot_q())) ### REPORTER if (with_reporter) { @@ -850,7 +851,7 @@ srv_g_correlationplot <- function(id, card$append_text("Comment", "header3") card$append_text(comment) } - card$append_src(teal.code::get_code(plot_q())) + card$append_src(code()) card } teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun) @@ -884,7 +885,7 @@ srv_g_correlationplot <- function(id, teal.widgets::verbatim_popup_srv( id = "rcode", - verbatim_content = reactive(teal.code::get_code(plot_q())), + verbatim_content = reactive(code()), title = "Show R Code for Correlation Plot" ) }) diff --git a/R/tm_g_gh_density_distribution_plot.R b/R/tm_g_gh_density_distribution_plot.R index 3ff36499..b37b6277 100644 --- a/R/tm_g_gh_density_distribution_plot.R +++ b/R/tm_g_gh_density_distribution_plot.R @@ -363,6 +363,7 @@ srv_g_density_distribution_plot <- function(id, # nolint hline_arb_color = .(hline_arb_color), rug_plot = .(rug_plot) ) + print(p) }) ) }), 800) @@ -377,7 +378,7 @@ srv_g_density_distribution_plot <- function(id, # nolint teal.code::eval_code( object = anl_q()$qenv, - code = bquote( + code = bquote({ tbl <- goshawk::t_summarytable( data = ANL, trt_group = .(trt_group), @@ -386,7 +387,8 @@ srv_g_density_distribution_plot <- function(id, # nolint xaxis_var = .(xaxis_var), font_size = .(font_size) ) - ) + tbl + }) ) }), 800) @@ -417,11 +419,11 @@ srv_g_density_distribution_plot <- function(id, # nolint teal.code::join(create_plot(), create_table()) }) + code <- reactive(teal.code::get_code(joined_qenvs())) + teal.widgets::verbatim_popup_srv( id = "rcode", - verbatim_content = reactive( - teal.code::get_code(joined_qenvs()) - ), + verbatim_content = reactive(code()), title = "Show R Code for Density Distribution Plot" ) @@ -449,11 +451,7 @@ srv_g_density_distribution_plot <- function(id, # nolint card$append_text("Comment", "header3") card$append_text(comment) } - card$append_src( - teal.code::get_code( - teal.code::join(create_plot(), create_table()) - ) - ) + card$append_src(code()) card } teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun) diff --git a/R/tm_g_gh_lineplot.R b/R/tm_g_gh_lineplot.R index 6639250e..7d6924ce 100644 --- a/R/tm_g_gh_lineplot.R +++ b/R/tm_g_gh_lineplot.R @@ -772,6 +772,8 @@ srv_lineplot <- function(id, width = plot_width, ) + code <- reactive(teal.code::get_code(plot_q())) + ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { @@ -800,7 +802,7 @@ srv_lineplot <- function(id, card$append_text("Comment", "header3") card$append_text(comment) } - card$append_src(teal.code::get_code(plot_q())) + card$append_src(code()) card } teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun) @@ -809,7 +811,7 @@ srv_lineplot <- function(id, teal.widgets::verbatim_popup_srv( id = "rcode", - verbatim_content = reactive(teal.code::get_code(plot_q())), + verbatim_content = reactive(code()), title = "Show R Code for Line Plot" ) }) diff --git a/R/tm_g_gh_scatterplot.R b/R/tm_g_gh_scatterplot.R index 69ee14ac..636a77cd 100644 --- a/R/tm_g_gh_scatterplot.R +++ b/R/tm_g_gh_scatterplot.R @@ -366,6 +366,8 @@ srv_g_scatterplot <- function(id, brushing = TRUE ) + code <- reactive(teal.code::get_code(plot_q())) + ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { @@ -394,7 +396,7 @@ srv_g_scatterplot <- function(id, card$append_text("Comment", "header3") card$append_text(comment) } - card$append_src(teal.code::get_code(plot_q())) + card$append_src(code()) card } teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun) @@ -434,7 +436,7 @@ srv_g_scatterplot <- function(id, teal.widgets::verbatim_popup_srv( id = "rcode", - verbatim_content = reactive(teal.code::get_code(plot_q())), + verbatim_content = reactive(code()), title = "Show R Code for Scatterplot" ) }) diff --git a/R/tm_g_gh_spaghettiplot.R b/R/tm_g_gh_spaghettiplot.R index 46d5344d..3a3ce894 100644 --- a/R/tm_g_gh_spaghettiplot.R +++ b/R/tm_g_gh_spaghettiplot.R @@ -524,6 +524,8 @@ srv_g_spaghettiplot <- function(id, brushing = TRUE ) + code <- reactive(teal.code::get_code(plot_q())) + ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { @@ -544,7 +546,7 @@ srv_g_spaghettiplot <- function(id, card$append_text("Comment", "header3") card$append_text(comment) } - card$append_src(teal.code::get_code(plot_q())) + card$append_src(code()) card } teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun) @@ -584,7 +586,7 @@ srv_g_spaghettiplot <- function(id, teal.widgets::verbatim_popup_srv( id = "rcode", - verbatim_content = reactive(teal.code::get_code(plot_q())), + verbatim_content = reactive(code()), title = "Show R Code for Spaghetti Plot" ) })