Skip to content

Commit 9c498c1

Browse files
committed
WIP implementation of teal_reportable
1 parent 38ee62e commit 9c498c1

12 files changed

+43
-52
lines changed

R/tm_a_pca.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,9 +1038,8 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
10381038
data = q,
10391039
decorators = select_decorators(decorators, obj_name),
10401040
expr = reactive({
1041-
substitute(print(.plot), env = list(.plot = as.name(obj_name)))
1042-
}),
1043-
expr_is_reactive = TRUE
1041+
substitute(.plot, env = list(.plot = as.name(obj_name)))
1042+
})
10441043
)
10451044
},
10461045
names(output_q),

R/tm_a_regression.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,11 @@ srv_a_regression <- function(id,
462462
)
463463
})
464464

465-
qenv <- reactive(
466-
teal.code::eval_code(data(), 'library("ggplot2");library("dplyr")') # nolint quotes
467-
)
465+
qenv <- reactive({
466+
obj <- data()
467+
teal.reporter::report(obj) <- c(teal.reporter::report(obj), "# Module's computation")
468+
teal.code::eval_code(obj, 'library("ggplot2");library("dplyr")') # nolint quotes
469+
})
468470

469471
anl_merged_q <- reactive({
470472
req(anl_merged_input())
@@ -991,16 +993,14 @@ srv_a_regression <- function(id,
991993
"Residuals vs Leverage" = output_plot_5(),
992994
"Cook's dist vs Leverage" = output_plot_6()
993995
)
994-
995-
teal.data::report(obj) <- c(teal.data::report(obj), "# Plot", obj[["plot"]])
996996
obj
997997
})
998998

999999
decorated_output_q <- srv_decorate_teal_data(
10001000
"decorator",
10011001
data = output_q,
10021002
decorators = select_decorators(decorators, "plot"),
1003-
expr = print(plot)
1003+
expr = quote(plot)
10041004
)
10051005

10061006
fitted <- reactive({

R/tm_g_association.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,10 +525,10 @@ srv_tm_g_association <- function(id,
525525
id = "decorator",
526526
data = output_q,
527527
decorators = select_decorators(decorators, "plot"),
528-
expr = {
528+
expr = quote({
529529
grid::grid.newpage()
530530
grid::grid.draw(plot)
531-
}
531+
})
532532
)
533533

534534
plot_r <- reactive({

R/tm_g_bivariate.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ srv_g_bivariate <- function(id,
711711
without_facet <- (is.null(nulled_row_facet_name) && is.null(nulled_col_facet_name)) || !facetting
712712

713713
print_call <- if (without_facet) {
714-
quote(print(plot))
714+
quote(plot)
715715
} else {
716716
substitute(
717717
expr = {
@@ -730,8 +730,7 @@ srv_g_bivariate <- function(id,
730730
)
731731
}
732732
print_call
733-
}),
734-
expr_is_reactive = TRUE
733+
})
735734
)
736735

737736
plot_r <- reactive(req(decorated_output_q_facets())[["plot"]])

R/tm_g_distribution.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,28 +1297,28 @@ srv_distribution <- function(id,
12971297
"d_density",
12981298
data = output_dist_q,
12991299
decorators = select_decorators(decorators, "histogram_plot"),
1300-
expr = print(histogram_plot)
1300+
expr = quote(histogram_plot)
13011301
)
13021302

13031303
decorated_output_qq_q <- srv_decorate_teal_data(
13041304
"d_qq",
13051305
data = output_qq_q,
13061306
decorators = select_decorators(decorators, "qq_plot"),
1307-
expr = print(qq_plot)
1307+
expr = quote(qq_plot)
13081308
)
13091309

13101310
decorated_output_summary_q <- srv_decorate_teal_data(
13111311
"d_summary",
13121312
data = output_summary_q,
13131313
decorators = select_decorators(decorators, "summary_table"),
1314-
expr = summary_table
1314+
expr = quote(summary_table)
13151315
)
13161316

13171317
decorated_output_test_q <- srv_decorate_teal_data(
13181318
"d_test",
13191319
data = output_test_q,
13201320
decorators = select_decorators(decorators, "test_table"),
1321-
expr = test_table
1321+
expr = quote(test_table)
13221322
)
13231323

13241324
decorated_output_q <- reactive({

R/tm_g_response.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ srv_g_response <- function(id,
579579
id = "decorator",
580580
data = output_q,
581581
decorators = select_decorators(decorators, "plot"),
582-
expr = print(plot)
582+
expr = quote(plot)
583583
)
584584

585585
plot_r <- reactive(req(decorated_output_plot_q())[["plot"]])

R/tm_g_scatterplot.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ srv_g_scatterplot <- function(id,
10231023
id = "decorator",
10241024
data = output_q,
10251025
decorators = select_decorators(decorators, "plot"),
1026-
expr = print(plot)
1026+
expr = quote(plot)
10271027
)
10281028

10291029
plot_r <- reactive(req(decorated_output_plot_q())[["plot"]])

R/tm_g_scatterplotmatrix.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ srv_g_scatterplotmatrix <- function(id,
464464
id = "decorator",
465465
data = output_q,
466466
decorators = select_decorators(decorators, "plot"),
467-
expr = print(plot)
467+
expr = quote(plot)
468468
)
469469

470470
plot_r <- reactive(req(decorated_output_q())[["plot"]])

R/tm_missing_data.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,34 +1269,34 @@ srv_missing_data <- function(id,
12691269
id = "dec_summary_plot",
12701270
data = summary_plot_q,
12711271
decorators = select_decorators(decorators, "summary_plot"),
1272-
expr = {
1272+
expr = quote({
12731273
grid::grid.newpage()
12741274
grid::grid.draw(summary_plot)
1275-
}
1275+
})
12761276
)
12771277

12781278
decorated_combination_plot_q <- srv_decorate_teal_data(
12791279
id = "dec_combination_plot",
12801280
data = combination_plot_q,
12811281
decorators = select_decorators(decorators, "combination_plot"),
1282-
expr = {
1282+
expr = quote({
12831283
grid::grid.newpage()
12841284
grid::grid.draw(combination_plot)
1285-
}
1285+
})
12861286
)
12871287

12881288
decorated_summary_table_q <- srv_decorate_teal_data(
12891289
id = "dec_summary_table",
12901290
data = summary_table_q,
12911291
decorators = select_decorators(decorators, "table"),
1292-
expr = table
1292+
expr = quote(table)
12931293
)
12941294

12951295
decorated_by_subject_plot_q <- srv_decorate_teal_data(
12961296
id = "dec_by_subject_plot",
12971297
data = by_subject_plot_q,
12981298
decorators = select_decorators(decorators, "by_subject_plot"),
1299-
expr = print(by_subject_plot)
1299+
expr = quote(by_subject_plot)
13001300
)
13011301

13021302
# Plots & tables reactives

R/tm_outliers.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,8 +1037,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var,
10371037
},
10381038
env = list(table_columns = input$table_ui_columns, .plot = as.name(obj_name))
10391039
)
1040-
}),
1041-
expr_is_reactive = TRUE
1040+
})
10421041
)
10431042
},
10441043
stats::setNames(nm = c("box_plot", "density_plot", "cumulative_plot")),
@@ -1051,7 +1050,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var,
10511050
"d_table",
10521051
data = decorated_final_q_no_table,
10531052
decorators = select_decorators(decorators, "table"),
1054-
expr = table
1053+
expr = quote(table)
10551054
)
10561055

10571056
output$summary_table <- DT::renderDataTable(

0 commit comments

Comments
 (0)