This module produces a multi-variable logistic regression table consistent with the TLG Catalog template
LGRT02 available here.
tm_t_logistic(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var = NULL,
arm_ref_comp = NULL,
paramcd,
cov_var = NULL,
avalc_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"AVALC"), "AVALC", fixed = TRUE),
conf_level = teal.transform::choices_selected(c(0.95, 0.9, 0.8), 0.95, keep_order =
TRUE),
pre_output = NULL,
post_output = NULL,
basic_table_args = teal.widgets::basic_table_args(),
transformators = list(),
decorators = list()
)(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() or NULL)
object
with all available choices and preselected option for variable names that can be used as arm_var. This defines
the grouping variable(s) in the results table. If there are two elements selected for arm_var, the second
variable will be nested under the first variable. If NULL, no arm/treatment variable is included in the
logistic model.
(list) optional,
if specified it must be a named list with each element corresponding to
an arm variable in ADSL and the element must be another list (possibly
with delayed teal.transform::variable_choices() or delayed teal.transform::value_choices()
with the elements named ref and comp that the defined the default
reference and comparison arms when the arm variable is changed.
(teal.transform::choices_selected())
object with all
available choices and preselected option for the parameter code variable from dataname.
(teal.transform::choices_selected())
object with all
available choices and preselected option for the covariates variables.
(teal.transform::choices_selected())
object with all
available choices and preselected option for the analysis variable (categorical).
(teal.transform::choices_selected())
object with
all available choices and pre-selected option for the confidence level, each within range of (0, 1).
(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.
a teal_module object.
This module generates the following objects, which can be modified in place using decorators:
table (TableTree - output of 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_logistic(
..., # 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
ADRS <- tmc_ex_adrs %>%
filter(PARAMCD %in% c("BESRSPI", "INVET"))
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADRS <- data[["ADRS"]]
arm_ref_comp <- list(
ACTARMCD = list(
ref = "ARM B",
comp = c("ARM A", "ARM C")
),
ARM = list(
ref = "B: Placebo",
comp = c("A: Drug X", "C: Combination")
)
)
app <- init(
data = data,
modules = modules(
tm_t_logistic(
label = "Logistic Regression",
dataname = "ADRS",
arm_var = choices_selected(
choices = variable_choices(ADRS, c("ARM", "ARMCD")),
selected = "ARM"
),
arm_ref_comp = arm_ref_comp,
paramcd = choices_selected(
choices = value_choices(ADRS, "PARAMCD", "PARAM"),
selected = "BESRSPI"
),
cov_var = choices_selected(
choices = c("SEX", "AGE", "BMRKR1", "BMRKR2"),
selected = "SEX"
)
)
)
)
#> Initializing tm_t_logistic
if (interactive()) {
shinyApp(app$ui, app$server)
}