Skip to content

Commit

Permalink
tdata to teal_data - tm_a_mmrm (#856)
Browse files Browse the repository at this point in the history
adapted to new `teal_data` class
  • Loading branch information
chlebowa authored Nov 23, 2023
1 parent 41d4b53 commit 95063ef
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions R/tm_a_mmrm.R
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,8 @@ srv_mmrm <- function(id,
ggplot2_args) {
with_reporter <- !missing(reporter) && inherits(reporter, "Reporter")
with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI")
checkmate::assert_class(data, "tdata")
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")

shiny::moduleServer(id, function(input, output, session) {
# Reactive responsible for sending a disable/enable signal
Expand Down Expand Up @@ -853,7 +854,7 @@ srv_mmrm <- function(id,
input,
output,
id_arm_var = extract_input("arm_var", parentname), # From UI.
data = data[[parentname]],
data = reactive(data()[[parentname]]),
arm_ref_comp = arm_ref_comp,
module = "tm_mmrm"
)
Expand Down Expand Up @@ -920,21 +921,19 @@ srv_mmrm <- function(id,
anl_inputs <- teal.transform::merge_expression_srv(
datasets = data,
selector_list = selector_list_without_cov,
join_keys = teal.data::join_keys(data),
merge_function = "dplyr::inner_join"
)

adsl_merge_inputs <- teal.transform::merge_expression_module(
datasets = data,
data_extract = list(arm_var = arm_var),
join_keys = teal.data::join_keys(data),
anl_name = "ANL_ADSL"
)

anl_q <- shiny::reactive({
qenv <- teal.code::new_qenv(tdata2env(data), code = get_code_tdata(data))
qenv2 <- teal.code::eval_code(qenv, as.expression(anl_inputs()$expr))
teal.code::eval_code(qenv2, as.expression(adsl_merge_inputs()$expr))
data() %>%
teal.code::eval_code(code = as.expression(anl_inputs()$expr)) %>%
teal.code::eval_code(code = as.expression(adsl_merge_inputs()$expr))
})

# Initially hide the output title because there is no output yet.
Expand Down

0 comments on commit 95063ef

Please sign in to comment.