View source: R/tm_t_exposure.R
tm_t_exposure | R Documentation |
The module produces an exposure table for risk management plan.
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(),
transformators = list(),
decorators = list()
)
a teal_module
object.
This module generates the following objects, which can be modified in place using decorators:
table
(ElementaryTable
as created from rtables::build_table
)
A Decorator is applied to the specific output using a named list of teal_transform_module
objects.
The name of this list corresponds to the name of the output to which the decorator is applied.
See code snippet below:
tm_t_exposure( ..., # arguments for module decorators = list( table = teal_transform_module(...) # applied only to `table` output ) )
For additional details and examples of decorators, refer to the vignette
vignette("decorate-module-output", package = "teal.modules.clinical")
.
To learn more please refer to the vignette
vignette("transform-module-output", package = "teal")
or the teal::teal_transform_module()
documentation.
The TLG Catalog where additional example apps implementing this module can be found.
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
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.