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

799 qenv prints plots to the device when running shiny app #800

Closed
wants to merge 6 commits into from
Closed
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
2 changes: 1 addition & 1 deletion R/tm_a_gee.R
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ srv_gee <- function(id,
})

table_r <- shiny::reactive({
table_q()[["result_table"]]
teal.code::get_var(table_q(), "result_table")
})

teal.widgets::table_with_settings_srv(
Expand Down
4 changes: 2 additions & 2 deletions R/tm_a_mmrm.R
Original file line number Diff line number Diff line change
Expand Up @@ -1396,8 +1396,8 @@ srv_mmrm <- function(id,

plot_r <- shiny::reactive({
switch(input$output_function,
g_mmrm_lsmeans = plot_q()[["lsmeans_plot"]],
g_mmrm_diagnostic = plot_q()[["diagnostic_plot"]]
g_mmrm_lsmeans = teal.code::get_var(plot_q(), "lsmeans_plot"),
g_mmrm_diagnostic = teal.code::get_var(plot_q(), "diagnostic_plot")
)
})

Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_barchart_simple.R
Original file line number Diff line number Diff line change
Expand Up @@ -487,11 +487,11 @@ srv_g_barchart_simple <- function(id,
teal.code::eval_code(qenv3, code = quote(print(plot)))
})

plot_r <- shiny::reactive(all_q()[["plot"]])
plot_r <- shiny::reactive(teal.code::get_var(all_q(), "plot"))

output$table <- shiny::renderTable({
shiny::req(iv_r()$is_valid())
all_q()[["counts"]]
teal.code::get_var(all_q(), "counts")
})

# get grouping variables
Expand Down
8 changes: 5 additions & 3 deletions R/tm_g_ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -412,15 +412,17 @@ srv_g_ci <- function(id, # nolint

all_q <- shiny::reactive({
teal::validate_inputs(iv_r())
teal::validate_has_data(anl_q()[["ANL"]], min_nrow = 2)
teal::validate_has_data(teal.code::get_var(anl_q(), "ANL"),
min_nrow = 2
)

x <- anl_inputs()$columns_source$x_var
y <- anl_inputs()$columns_source$y_var
color <- anl_inputs()$columns_source$color

shiny::validate(
shiny::need(
!all(is.na(anl_q()[["ANL"]][[y]])),
!all(is.na(teal.code::get_var(anl_q(), "ANL")[[y]])),
"No valid data. Please check the filtering option for analysis value (y axis)"
)
)
Expand Down Expand Up @@ -459,7 +461,7 @@ srv_g_ci <- function(id, # nolint
teal.code::eval_code(anl_q(), list_calls)
})

plot_r <- shiny::reactive(all_q()[["gg"]])
plot_r <- shiny::reactive(teal.code::get_var(anl_q(), "gg"))

teal.widgets::verbatim_popup_srv(
id = "warning",
Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_forest_rsp.R
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ srv_g_forest_rsp <- function(id,
),
handlerExpr = {
shiny::req(anl_q())
anl <- anl_q()[["ANL"]]
anl <- teal.code::get_var(anl_q(), "ANL")
aval_var <- anl_inputs()$columns_source$aval_var
paramcd_level <- unlist(anl_inputs()$filter_info$paramcd[[1]]$selected)
if (length(paramcd_level) == 0) {
Expand Down Expand Up @@ -694,7 +694,7 @@ srv_g_forest_rsp <- function(id,
teal.code::eval_code(qenv, as.expression(my_calls))
})

plot_r <- shiny::reactive(all_q()[["p"]])
plot_r <- shiny::reactive(teal.code::get_var(all_q(), "p"))

pws <- teal.widgets::plot_with_settings_srv(
id = "myplot",
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_forest_tte.R
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ srv_g_forest_tte <- function(id,
})

# Outputs to render.
plot_r <- shiny::reactive(all_q()[["p"]])
plot_r <- shiny::reactive(teal.code::get_var(all_q(), "p"))

pws <- teal.widgets::plot_with_settings_srv(
id = "myplot",
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_ipp.R
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ srv_g_ipp <- function(id,
})

# Outputs to render.
plot_r <- shiny::reactive(all_q()[["plot"]])
plot_r <- shiny::reactive(teal.code::get_var(all_q(), "plot"))

# Insert the plot into a plot with settings module from teal.widgets
pws <- teal.widgets::plot_with_settings_srv(
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_km.R
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ srv_g_km <- function(id,
teal.code::eval_code(qenv, as.expression(my_calls))
})

plot_r <- shiny::reactive(all_q()[["plot"]])
plot_r <- shiny::reactive(teal.code::get_var(all_q(), "plot"))

# Insert the plot into a plot with settings module from teal.widgets
pws <- teal.widgets::plot_with_settings_srv(
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_lineplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ srv_g_lineplot <- function(id,
teal.code::eval_code(merged$anl_q(), as.expression(my_calls))
})

plot_r <- shiny::reactive(all_q()[["plot"]])
plot_r <- shiny::reactive(teal.code::get_var(all_q(), "plot"))

# Insert the plot into a plot with settings module from teal.widgets
pws <- teal.widgets::plot_with_settings_srv(
Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_pp_adverse_events.R
Original file line number Diff line number Diff line change
Expand Up @@ -527,13 +527,13 @@ srv_g_adverse_events <- function(id,
teal.code::eval_code(qenv2, as.expression(calls))
})
output$table <- DT::renderDataTable(
expr = all_q()[["table"]],
expr = teal.code::get_var(all_q(), "table"),
options = list(pageLength = input$table_rows)
)

plot_r <- shiny::reactive({
shiny::req(iv_r()$is_valid())
all_q()[["plot"]]
teal.code::get_var(all_q(), "plot")
})

pws <- teal.widgets::plot_with_settings_srv(
Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_pp_patient_timeline.R
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ srv_g_patient_timeline <- function(id,
ae_chart_vars_null <- any(vapply(list(aeterm, aetime_start, aetime_end), is.null, FUN.VALUE = logical(1)))
ds_chart_vars_null <- any(vapply(list(cmdecod, dstime_start, dstime_end), is.null, FUN.VALUE = logical(1)))

p_timeline_data <- anl_q()[["ANL"]]
p_timeline_data <- teal.code::get_var(anl_q(), "ANL")
# time variables can not be NA
p_time_data_pat <- p_timeline_data[p_timeline_data[[patient_col]] == patient_id(), ]

Expand Down Expand Up @@ -873,7 +873,7 @@ srv_g_patient_timeline <- function(id,
teal.code::eval_code(as.expression(patient_timeline_calls))
})

plot_r <- shiny::reactive(all_q()[["patient_timeline_plot"]])
plot_r <- shiny::reactive(teal.code::get_var(all_q(), "patient_timeline_plot"))

pws <- teal.widgets::plot_with_settings_srv(
id = "patient_timeline_plot",
Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_pp_therapy.R
Original file line number Diff line number Diff line change
Expand Up @@ -650,14 +650,14 @@ srv_g_therapy <- function(id,

output$therapy_table <- DT::renderDataTable(
expr = {
all_q()[["therapy_table"]]
teal.code::get_var(all_q(), "therapy_table")
},
options = list(pageLength = input$therapy_table_rows)
)

plot_r <- shiny::reactive({
shiny::req(iv_r()$is_valid())
all_q()[["therapy_plot"]]
teal.code::get_var(all_q(), "therapy_plot")
})

pws <- teal.widgets::plot_with_settings_srv(
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_pp_vitals.R
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ srv_g_vitals <- function(id,
teal.code::eval_code(as.expression(my_calls))
})

plot_r <- shiny::reactive(all_q()[["result_plot"]])
plot_r <- shiny::reactive(teal.code::get_var(all_q(), "result_plot"))

pws <- teal.widgets::plot_with_settings_srv(
id = "vitals_plot",
Expand Down