View source: R/tm_t_events_patyear.R
tm_t_events_patyear | R Documentation |
This module produces a table of event rates adjusted for patient-years.
tm_t_events_patyear(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var,
events_var,
paramcd,
aval_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"AVAL"), "AVAL", fixed = TRUE),
avalu_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"AVALU"), "AVALU", fixed = TRUE),
add_total = TRUE,
total_label = default_total_label(),
na_level = default_na_str(),
conf_level = teal.transform::choices_selected(c(0.95, 0.9, 0.8), 0.95, keep_order =
TRUE),
drop_arm_levels = TRUE,
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_events_patyear( ..., # 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
ADAETTE <- tmc_ex_adaette %>%
filter(PARAMCD %in% c("AETTE1", "AETTE2", "AETTE3")) %>%
mutate(is_event = CNSR == 0) %>%
mutate(n_events = as.integer(is_event))
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADAETTE <- data[["ADAETTE"]]
# 1. Basic Example
app <- init(
data = data,
modules = modules(
tm_t_events_patyear(
label = "AE Rate Adjusted for Patient-Years At Risk Table",
dataname = "ADAETTE",
arm_var = choices_selected(
choices = variable_choices(ADSL, c("ARM", "ARMCD")),
selected = "ARMCD"
),
add_total = TRUE,
events_var = choices_selected(
choices = variable_choices(ADAETTE, "n_events"),
selected = "n_events",
fixed = TRUE
),
paramcd = choices_selected(
choices = value_choices(ADAETTE, "PARAMCD", "PARAM"),
selected = "AETTE1"
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
# 2. Example with table split on 2 arm_var variables
app <- init(
data = data,
modules = modules(
tm_t_events_patyear(
label = "AE Rate Adjusted for Patient-Years At Risk Table",
dataname = "ADAETTE",
arm_var = choices_selected(
choices = variable_choices(ADSL, c("ARM", "ARMCD", "SEX")),
selected = c("ARM", "SEX")
),
add_total = TRUE,
events_var = choices_selected(
choices = variable_choices(ADAETTE, "n_events"),
selected = "n_events",
fixed = TRUE
),
paramcd = choices_selected(
choices = value_choices(ADAETTE, "PARAMCD", "PARAM"),
selected = "AETTE1"
)
)
)
)
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.