|
1 | 1 | #' Template: Summarize Variables by Row Groups Module |
2 | 2 | #' |
| 3 | +#' Creates a valid expression to generate a table to summarize variables by row groups. |
| 4 | +#' |
3 | 5 | #' @inheritParams template_arguments |
4 | | -#' @param parallel_vars (`logical`)\cr used to display `summarize_vars` as parallel columns |
5 | | -#' (`FALSE` on default). Can be used only if all chosen analysis variables are numeric. |
6 | | -#' @param row_groups (`logical`)\cr used to display `summarize_vars` as row groups |
7 | | -#' (`FALSE` on default). |
8 | | -#' @param numeric_stats (`character`)\cr |
9 | | -#' selected statistics for numeric summarize variables to be displayed. Possible values are `n`, `mean_sd`, `mean_ci`, |
10 | | -#' `median`, `median_ci`, `quantiles`, `range`. All are selected by default. |
11 | | -#' @param drop_zero_levels (`logical`)\cr used to remove rows with zero counts from the result table. |
| 6 | +#' @param parallel_vars (`logical`)\cr whether summarized variables should be arranged in columns. Can only be set to |
| 7 | +#' `TRUE` if all chosen analysis variables are numeric. |
| 8 | +#' @param row_groups (`logical`)\cr whether summarized variables should be arranged in row groups. |
| 9 | +#' @param drop_zero_levels (`logical`)\cr whether rows with zero counts in all columns should be removed from the table. |
| 10 | +#' |
| 11 | +#' @inherit template_arguments return |
12 | 12 | #' |
13 | 13 | #' @seealso [tm_t_summary_by()] |
14 | | -#' @keywords internal |
15 | 14 | #' |
| 15 | +#' @keywords internal |
16 | 16 | template_summary_by <- function(parentname, |
17 | 17 | dataname, |
18 | 18 | arm_var, |
@@ -106,7 +106,6 @@ template_summary_by <- function(parentname, |
106 | 106 | ) |
107 | 107 | } |
108 | 108 |
|
109 | | - |
110 | 109 | table_title <- paste("Summary Table for", paste(sum_vars, collapse = ", "), "by", paste(by_vars, collapse = ", ")) |
111 | 110 |
|
112 | 111 | parsed_basic_table_args <- teal.widgets::parse_basic_table_args( |
@@ -314,21 +313,18 @@ template_summary_by <- function(parentname, |
314 | 313 | y |
315 | 314 | } |
316 | 315 |
|
317 | | -#' Teal Module: Summarize Variables by Row Groups Module |
| 316 | +#' teal Module: Summarize Variables by Row Groups |
| 317 | +#' |
| 318 | +#' This module produces a table to summarize variables by row groups. |
318 | 319 | #' |
319 | | -#' @param drop_arm_levels (`logical`)\cr drop the unused `arm_var` levels. |
320 | | -#' When `TRUE`, `arm_var` levels are set to those used in the `dataname` dataset. When `FALSE`, |
321 | | -#' `arm_var` levels are set to those used in the `parentname` dataset. |
322 | | -#' If `dataname` dataset and `parentname` dataset are the same (i.e. `ADSL`), then `drop_arm_levels` will always be |
323 | | -#' TRUE regardless of the user choice when `tm_t_summary_by` is called. |
324 | | -#' @param numeric_stats (`character`)\cr |
325 | | -#' selected statistics for numeric summarize variables to be displayed. Possible values are `n`, `mean_sd`, `mean_ci`, |
326 | | -#' `median`, `median_ci`, `range`, `geom_mean`. By default, `n`, `mean_sd`, `median`, `range` are selected. |
327 | | -#' @param drop_zero_levels (`logical`)\cr used to remove rows with zero counts from the result table. |
328 | 320 | #' @inheritParams module_arguments |
329 | 321 | #' @inheritParams template_summary_by |
330 | 322 | #' |
331 | | -#' @export |
| 323 | +#' @inherit module_arguments return |
| 324 | +#' |
| 325 | +#' @seealso The [TLG Catalog](https://insightsengineering.github.io/tlg-catalog/stable/) where additional example |
| 326 | +#' apps implementing this module can be found. |
| 327 | +#' |
332 | 328 | #' @examples |
333 | 329 | #' ADSL <- tmc_ex_adsl |
334 | 330 | #' ADLB <- tmc_ex_adlb |
@@ -370,6 +366,8 @@ template_summary_by <- function(parentname, |
370 | 366 | #' if (interactive()) { |
371 | 367 | #' shinyApp(app$ui, app$server) |
372 | 368 | #' } |
| 369 | +#' |
| 370 | +#' @export |
373 | 371 | tm_t_summary_by <- function(label, |
374 | 372 | dataname, |
375 | 373 | parentname = ifelse( |
@@ -455,7 +453,7 @@ tm_t_summary_by <- function(label, |
455 | 453 | ) |
456 | 454 | } |
457 | 455 |
|
458 | | -#' @noRd |
| 456 | +#' @keywords internal |
459 | 457 | ui_summary_by <- function(id, ...) { |
460 | 458 | ns <- shiny::NS(id) |
461 | 459 | a <- list(...) |
@@ -576,8 +574,7 @@ ui_summary_by <- function(id, ...) { |
576 | 574 | ) |
577 | 575 | } |
578 | 576 |
|
579 | | - |
580 | | -#' @noRd |
| 577 | +#' @keywords internal |
581 | 578 | srv_summary_by <- function(id, |
582 | 579 | data, |
583 | 580 | reporter, |
|
0 commit comments