tm_t_exposure {teal.modules.clinical} | R Documentation |
teal Module: Exposure Table for Risk management plan
Description
The module produces an exposure table for risk management plan.
Usage
tm_t_exposure(
label,
dataname,
parentname = ifelse(inherits(col_by_var, "data_extract_spec"),
teal.transform::datanames_input(col_by_var), "ADSL"),
row_by_var,
col_by_var,
paramcd = teal.transform::choices_selected(choices =
teal.transform::value_choices(dataname, "PARAMCD", "PARAM"), selected = "TDURD"),
paramcd_label = "PARAM",
id_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
subset = "USUBJID"), selected = "USUBJID", fixed = TRUE),
parcat,
aval_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
subset = "AVAL"), selected = "AVAL", fixed = TRUE),
avalu_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
subset = "AVALU"), selected = "AVALU", fixed = TRUE),
add_total,
total_label = default_total_label(),
add_total_row = TRUE,
total_row_label = "Total number of patients and patient time*",
na_level = default_na_str(),
pre_output = NULL,
post_output = NULL,
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
row_by_var |
( |
col_by_var |
( |
paramcd |
( |
paramcd_label |
( |
id_var |
( |
parcat |
( |
aval_var |
( |
avalu_var |
( |
add_total |
( |
total_label |
( |
add_total_row |
( |
total_row_label |
( |
na_level |
( |
pre_output |
( |
post_output |
( |
basic_table_args |
( |
Value
a teal_module
object.
See Also
The TLG Catalog where additional example apps implementing this module can be found.
Examples
library(dplyr)
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADEX <- tmc_ex_adex
set.seed(1, kind = "Mersenne-Twister")
labels <- col_labels(ADEX, fill = FALSE)
ADEX <- ADEX %>%
distinct(USUBJID, .keep_all = TRUE) %>%
mutate(
PARAMCD = "TDURD",
PARAM = "Overall duration (days)",
AVAL = sample(x = seq(1, 200), size = n(), replace = TRUE),
AVALU = "Days"
) %>%
bind_rows(ADEX)
col_labels(ADEX) <- labels
})
datanames <- c("ADSL", "ADEX")
datanames(data) <- datanames
join_keys(data) <- default_cdisc_join_keys[datanames]
app <- init(
data = data,
modules = modules(
tm_t_exposure(
label = "Duration of Exposure Table",
dataname = "ADEX",
paramcd = choices_selected(
choices = value_choices(data[["ADEX"]], "PARAMCD", "PARAM"),
selected = "TDURD"
),
col_by_var = choices_selected(
choices = variable_choices(data[["ADEX"]], subset = c("SEX", "ARM")),
selected = "SEX"
),
row_by_var = choices_selected(
choices = variable_choices(data[["ADEX"]], subset = c("RACE", "REGION1", "STRATA1", "SEX")),
selected = "RACE"
),
parcat = choices_selected(
choices = value_choices(data[["ADEX"]], "PARCAT2"),
selected = "Drug A"
),
add_total = FALSE
)
),
filter = teal_slices(teal_slice("ADSL", "SAFFL", selected = "Y"))
)
if (interactive()) {
shinyApp(app$ui, app$server)
}