Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

291 add print(p) and print(tbl) to the output of boxplot and density plot #293

Merged
merged 6 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions R/tm_g_gh_boxplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ srv_g_boxplot <- function(id,
font_size = .(font_size),
unit = .("AVALU")
)
print(p)
})
)
}), 800)
Expand All @@ -479,6 +480,7 @@ srv_g_boxplot <- function(id,
xaxis_var = .(xaxis_var),
facet_var = .(facet_var)
)
tbl
})
)
}), 800)
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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"
)
})
Expand Down
5 changes: 3 additions & 2 deletions R/tm_g_gh_correlationplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,7 @@ srv_g_correlationplot <- function(id,
brushing = TRUE
)

code <- reactive(teal.code::get_code(plot_q()))

### REPORTER
if (with_reporter) {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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"
)
})
Expand Down
18 changes: 8 additions & 10 deletions R/tm_g_gh_density_distribution_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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),
Expand All @@ -386,7 +387,8 @@ srv_g_density_distribution_plot <- function(id, # nolint
xaxis_var = .(xaxis_var),
font_size = .(font_size)
)
)
tbl
})
)
}), 800)

Expand Down Expand Up @@ -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"
)

Expand Down Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions R/tm_g_gh_lineplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand All @@ -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"
)
})
Expand Down
6 changes: 4 additions & 2 deletions R/tm_g_gh_scatterplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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"
)
})
Expand Down
6 changes: 4 additions & 2 deletions R/tm_g_gh_spaghettiplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
Expand Down Expand Up @@ -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"
)
})
Expand Down
Loading