tm_t_abnormality {teal.modules.clinical} | R Documentation |
teal Module: Abnormality Summary Table
Description
This module produces a table to summarize abnormality.
Usage
tm_t_abnormality(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var,
by_vars,
grade,
abnormal = list(low = c("LOW", "LOW LOW"), high = c("HIGH", "HIGH HIGH")),
id_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
subset = "USUBJID"), selected = "USUBJID", fixed = TRUE),
baseline_var =
teal.transform::choices_selected(teal.transform::variable_choices(dataname, subset =
"BNRIND"), selected = "BNRIND", fixed = TRUE),
treatment_flag_var =
teal.transform::choices_selected(teal.transform::variable_choices(dataname, subset =
"ONTRTFL"), selected = "ONTRTFL", fixed = TRUE),
treatment_flag = teal.transform::choices_selected("Y"),
add_total = TRUE,
total_label = default_total_label(),
exclude_base_abn = FALSE,
drop_arm_levels = TRUE,
pre_output = NULL,
post_output = NULL,
na_level = default_na_str(),
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
by_vars |
( |
grade |
( |
abnormal |
( |
id_var |
( |
baseline_var |
( |
treatment_flag_var |
( |
treatment_flag |
( |
add_total |
( |
total_label |
( |
exclude_base_abn |
( |
drop_arm_levels |
( |
pre_output |
( |
post_output |
( |
na_level |
( |
basic_table_args |
( |
Value
a teal_module
object.
Note
Patients with the same abnormality at baseline as on the treatment visit can be
excluded in accordance with GDSR specifications by using exclude_base_abn
.
See Also
The TLG Catalog where additional example apps implementing this module can be found.
Examples
data <- teal_data()
data <- within(data, {
library(dplyr)
ADSL <- tmc_ex_adsl
ADLB <- tmc_ex_adlb %>%
mutate(
ONTRTFL = case_when(
AVISIT %in% c("SCREENING", "BASELINE") ~ "",
TRUE ~ "Y"
) %>% with_label("On Treatment Record Flag")
)
})
datanames <- c("ADSL", "ADLB")
datanames(data) <- datanames
join_keys(data) <- default_cdisc_join_keys[datanames]
app <- init(
data = data,
modules = modules(
tm_t_abnormality(
label = "Abnormality Table",
dataname = "ADLB",
arm_var = choices_selected(
choices = variable_choices(data[["ADSL"]], subset = c("ARM", "ARMCD")),
selected = "ARM"
),
add_total = FALSE,
by_vars = choices_selected(
choices = variable_choices(data[["ADLB"]], subset = c("LBCAT", "PARAM", "AVISIT")),
selected = c("LBCAT", "PARAM"),
keep_order = TRUE
),
baseline_var = choices_selected(
variable_choices(data[["ADLB"]], subset = "BNRIND"),
selected = "BNRIND", fixed = TRUE
),
grade = choices_selected(
choices = variable_choices(data[["ADLB"]], subset = "ANRIND"),
selected = "ANRIND",
fixed = TRUE
),
abnormal = list(low = "LOW", high = "HIGH"),
exclude_base_abn = FALSE
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}