Skip to content

Commit ebe7c1d

Browse files
committed
feat: convert tm_outliers
1 parent fe3a48a commit ebe7c1d

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

R/tm_outliers.R

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#' - `box_plot` (`ggplot2`)
2222
#' - `density_plot` (`ggplot2`)
2323
#' - `cumulative_plot` (`ggplot2`)
24-
#' - `table` ([DT::datatable()])
24+
#' - `table` (`listing_df` created with [rlistings::as_listing()])
2525
#'
2626
#' Decorators can be applied to all outputs or only to specific objects using a
2727
#' named list of `teal_transform_module` objects.
@@ -719,15 +719,10 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var,
719719
within(qenv, summary_table <- data.frame())
720720
}
721721

722-
# Datatable is generated in qenv to allow for output decoration
722+
# Generate decoratable object from data
723723
qenv <- within(qenv, {
724-
table <- DT::datatable(
725-
summary_table,
726-
options = list(
727-
dom = "t",
728-
autoWidth = TRUE,
729-
columnDefs = list(list(width = "200px", targets = "_all"))
730-
)
724+
table <- rlistings::as_listing(
725+
tibble::rownames_to_column(summary_table, var = " ")
731726
)
732727
})
733728

@@ -1044,7 +1039,14 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var,
10441039
if (iv_r()$is_valid()) {
10451040
categorical_var <- as.vector(merged$anl_input_r()$columns_source$categorical_var)
10461041
if (!is.null(categorical_var)) {
1047-
decorated_final_q()[["table"]]
1042+
DT::datatable(
1043+
decorated_final_q()[["summary_table"]],
1044+
options = list(
1045+
dom = "t",
1046+
autoWidth = TRUE,
1047+
columnDefs = list(list(width = "200px", targets = "_all"))
1048+
)
1049+
)
10481050
}
10491051
}
10501052
}
@@ -1319,7 +1321,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var,
13191321
)
13201322
categorical_var <- as.vector(merged$anl_input_r()$columns_source$categorical_var)
13211323
if (length(categorical_var) > 0) {
1322-
summary_table <- common_code_q()[["summary_table"]]
1324+
summary_table <- decorated_final_q()[["table"]]
13231325
card$append_text("Summary Table", "header3")
13241326
card$append_table(summary_table)
13251327
}

man/tm_outliers.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)