Skip to content

Commit f0600dc

Browse files
committed
feat: improvements to tm_missing
1 parent e734d5c commit f0600dc

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

R/tm_g_scatterplotmatrix.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,9 @@ srv_g_scatterplotmatrix <- function(id,
333333

334334
anl_merged_q <- reactive({
335335
req(anl_merged_input())
336-
qenv <- teal.code::eval_code(data(), 'library("dplyr");library("lattice")') # nolint quotes
336+
obj <- data()
337+
teal.reporter::teal_card(obj) <- c(teal.reporter::teal_card(obj), "# Module's computation")
338+
qenv <- teal.code::eval_code(obj, 'library("dplyr");library("lattice")') # nolint: quotes.
337339
teal.code::eval_code(qenv, as.expression(anl_merged_input()$expr))
338340
})
339341

R/tm_missing_data.R

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ srv_page_missing_data <- function(id, data, reporter, filter_panel_api, dataname
265265
})
266266
})
267267

268-
lapply(
268+
result <- sapply(
269269
datanames,
270270
function(x) {
271271
srv_missing_data(
@@ -280,8 +280,18 @@ srv_page_missing_data <- function(id, data, reporter, filter_panel_api, dataname
280280
ggplot2_args = ggplot2_args,
281281
decorators = decorators
282282
)
283-
}
283+
},
284+
USE.NAMES = TRUE,
285+
simplify = FALSE
284286
)
287+
288+
reactive({
289+
if (is.null(input$dataname_tab)) {
290+
teal.data::teal_data()
291+
} else {
292+
result[[input$dataname_tab]]()
293+
}
294+
})
285295
})
286296
}
287297

@@ -521,7 +531,10 @@ srv_missing_data <- function(id,
521531

522532
group_var <- input$group_by_var
523533
anl <- data_r()
524-
qenv <- teal.code::eval_code(data(), {
534+
obj <- data()
535+
teal.reporter::teal_card(obj) <- c(teal.reporter::teal_card(obj), "# Module's computation")
536+
537+
qenv <- teal.code::eval_code(obj, {
525538
'library("dplyr");library("ggplot2");library("tidyr");library("gridExtra")' # nolint quotes
526539
})
527540

@@ -1272,6 +1285,7 @@ srv_missing_data <- function(id,
12721285
expr = quote({
12731286
grid::grid.newpage()
12741287
grid::grid.draw(summary_plot)
1288+
summary_plot
12751289
})
12761290
)
12771291

@@ -1282,6 +1296,7 @@ srv_missing_data <- function(id,
12821296
expr = quote({
12831297
grid::grid.newpage()
12841298
grid::grid.draw(combination_plot)
1299+
combination_plot
12851300
})
12861301
)
12871302

@@ -1417,5 +1432,7 @@ srv_missing_data <- function(id,
14171432
teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun)
14181433
}
14191434
###
1435+
1436+
decorated_final_q
14201437
})
14211438
}

R/utils.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ srv_decorate_teal_data <- function(id, data, decorators, expr) {
318318
decorated_output()
319319
} else {
320320
req(expr_r())
321-
teal.code::eval_code(decorated_output(), expr_r(), cache = TRUE)
321+
teal.code::eval_code(decorated_output(), expr_r(), keep_output = TRUE)
322322
}
323323
})
324324
})

0 commit comments

Comments
 (0)