
Last chance! 50% off unlimited learning
Sale ends in
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.
(character
)
menu item label of the module in the teal app.
(character
)
analysis data used in teal module.
(character
)
parent analysis data used in teal module, usually this refers to ADSL
.
(teal.transform::choices_selected()
)
object with all available choices and preselected option for
variable names that can be used to split rows.
(teal.transform::choices_selected()
)
object with all available choices and preselected option for
variable names that can be used to split columns.
(teal.transform::choices_selected()
)
object with all
available choices and preselected option for the parameter code variable from dataname
.
(character
)
the column from the dataset where the value will be used to
label the argument paramcd
.
(teal.transform::choices_selected()
)
object specifying
the variable name for subject id.
(teal.transform::choices_selected()
)
object with all available choices and preselected option for
parameter category values.
(teal.transform::choices_selected()
)
object with
all available choices and pre-selected option for the analysis variable.
(teal.transform::choices_selected()
)
object with
all available choices and preselected option for the analysis unit variable.
(logical
)
whether to include column with total number of patients.
(string
)
string to display as total column/row label if column/row is
enabled (see add_total
). Defaults to "All Patients"
. To set a new default total_label
to
apply in all modules, run set_default_total_label("new_default")
.
(flag
)
whether a "total" level should be added after the others which includes all the
levels that constitute the split. A custom label can be set for this level via the total_row_label
argument.
(character
)
string to display as total row label if row is
enabled (see add_total_row
).
(string
)
used to replace all NA
or empty values
in character or factor variables in the data. Defaults to "<Missing>"
. To set a
default na_level
to apply in all modules, run set_default_na_str("new_default")
.
(shiny.tag
) optional,
with text placed before the output to put the output into context.
For example a title.
(shiny.tag
) optional,
with text placed after the output to put the output into context.
For example the shiny::helpText()
elements are useful.
(basic_table_args
) optional
object created by teal.widgets::basic_table_args()
with settings for the module table. The argument is merged with option teal.basic_table_args
and with default
module arguments (hard coded in the module body).
For more details, see the vignette: vignette("custom-basic-table-arguments", package = "teal.widgets")
.
(list
of teal_transform_module
) that will be applied to transform module's data input.
To learn more check vignette("transform-input-data", package = "teal")
.
(named
list
of lists of teal_transform_module
) optional,
decorator for tables or plots included in the module output reported.
The decorators are applied to the respective output objects.
See section "Decorating Module" below for more details.
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)
}
Run the code above in your browser using DataLab