Title: | 'teal' Modules for Standard Clinical Outputs |
Version: | 0.10.0 |
Date: | 2025-02-26 |
Description: | Provides user-friendly tools for creating and customizing clinical trial reports. By leveraging the 'teal' framework, this package provides 'teal' modules to easily create an interactive panel that allows for seamless adjustments to data presentation, thereby streamlining the creation of detailed and accurate reports. |
License: | Apache License 2.0 |
URL: | https://insightsengineering.github.io/teal.modules.clinical/, https://github.com/insightsengineering/teal.modules.clinical/ |
BugReports: | https://github.com/insightsengineering/teal.modules.clinical/issues |
Depends: | R (≥ 4.0), teal (≥ 0.16.0), teal.transform (≥ 0.6.0), tern (≥ 0.9.7) |
Imports: | broom (≥ 0.7.10), checkmate (≥ 2.1.0), cowplot (≥ 0.7.0), dplyr (≥ 1.0.5), DT (≥ 0.13), ggplot2 (≥ 3.4.0), ggrepel, grid, lifecycle (≥ 0.2.0), methods, rlistings (≥ 0.2.10), rmarkdown (≥ 2.23), rtables (≥ 0.6.11), scales, shiny (≥ 1.6.0), shinyjs, shinyvalidate, shinyWidgets (≥ 0.5.1), stats, teal.code (≥ 0.6.1), teal.data (≥ 0.7.0), teal.logger (≥ 0.3.2), teal.reporter (≥ 0.4.0), teal.widgets (≥ 0.4.3), tern.gee (≥ 0.1.5), tern.mmrm (≥ 0.3.1), utils, vistime (≥ 1.2.3) |
Suggests: | forcats, knitr (≥ 1.42), logger (≥ 0.2.0), lubridate (≥ 1.7.9), nestcolor (≥ 0.1.0), pkgload, roxy.shinylive, rvest, shinytest2, styler, testthat (≥ 3.1.5), withr (> 2.0.1.5) |
VignetteBuilder: | knitr, rmarkdown |
Config/Needs/verdepcheck: | insightsengineering/teal, insightsengineering/teal.slice, insightsengineering/teal.transform, insightsengineering/tern, tidymodels/broom, mllg/checkmate, wilkelab/cowplot, tidyverse/dplyr, rstudio/DT, tidyverse/ggplot2, slowkow/ggrepel, r-lib/lifecycle, daroczig/logger, insightsengineering/rlistings, rstudio/rmarkdown, insightsengineering/rtables, r-lib/scales, rstudio/shiny, daattali/shinyjs, rstudio/shinyvalidate, dreamRs/shinyWidgets, insightsengineering/teal.code, insightsengineering/teal.data, insightsengineering/teal.logger, insightsengineering/teal.reporter, insightsengineering/teal.widgets, insightsengineering/tern.gee, insightsengineering/tern.mmrm, shosaco/vistime, tidyverse/forcats, yihui/knitr, tidyverse/lubridate, insightsengineering/nestcolor, r-lib/pkgload, insightsengineering/roxy.shinylive, tidyverse/rvest, rstudio/shinytest2, r-lib/styler, r-lib/testthat, r-lib/withr |
Config/Needs/website: | insightsengineering/nesttemplate |
Config/testthat/edition: | 3 |
Encoding: | UTF-8 |
Language: | en-US |
LazyData: | true |
RoxygenNote: | 7.3.2 |
NeedsCompilation: | no |
Packaged: | 2025-02-28 15:10:15 UTC; unardid |
Author: | Joe Zhu |
Maintainer: | Dawid Kaledkowski <dawid.kaledkowski@roche.com> |
Repository: | CRAN |
Date/Publication: | 2025-02-28 15:50:02 UTC |
teal
Modules for Standard Clinical Outputs
Description
Provides teal modules for the standard clinical trials outputs. The teal modules add an encoding panel to interactively change the encodings within teal.
Author(s)
Maintainer: Dawid Kaledkowski dawid.kaledkowski@roche.com
Authors:
Joe Zhu joe.zhu@roche.com (ORCID)
Jana Stoilova jana.stoilova@roche.com
Davide Garolini davide.garolini@roche.com
Emily de la Rua emily.de_la_rua@contractors.roche.com
Abinaya Yogasekaram abinaya.yogasekaram@contractors.roche.com
Mahmoud Hallal mahmoud.hallal@roche.com
Rosemary Li li.yaqiong@gene.com
Heng Wang wang.heng@gene.com
Pawel Rucki pawel.rucki@roche.com
Nikolas Burkoff
Konrad Pagacz
Other contributors:
Vaakesan Sundrelingam [contributor]
Francois Collin [contributor]
Imanol Zubizarreta [contributor]
F. Hoffmann-La Roche AG [copyright holder, funder]
See Also
Useful links:
-
https://insightsengineering.github.io/teal.modules.clinical/
-
https://github.com/insightsengineering/teal.modules.clinical/
Report bugs at https://github.com/insightsengineering/teal.modules.clinical/issues
Expression List
Description
Add a new expression to a list (of expressions).
Usage
add_expr(expr_ls, new_expr)
Arguments
expr_ls |
( |
new_expr |
( |
Details
Offers a stricter control to add new expressions to an existing
list. The list of expressions can be later used to generate a pipeline,
for instance with pipe_expr
.
Value
a list
of call
.
Examples
library(rtables)
lyt <- list()
lyt <- add_expr(lyt, substitute(basic_table()))
lyt <- add_expr(
lyt, substitute(split_cols_by(var = arm), env = list(armcd = "ARMCD"))
)
lyt <- add_expr(
lyt,
substitute(
test_proportion_diff(
vars = "rsp", method = "cmh", variables = list(strata = "strata")
)
)
)
lyt <- add_expr(lyt, quote(build_table(df = dta)))
pipe_expr(lyt)
Observer for Treatment reference variable
Description
Updates the reference and comparison Treatments when the selected Treatment variable changes
Usage
arm_ref_comp_observer(
session,
input,
output,
id_ref = "Ref",
id_comp = "Comp",
id_arm_var,
data,
arm_ref_comp,
module,
on_off = reactive(TRUE),
input_id = "buckets",
output_id = "arms_buckets"
)
Arguments
session |
( |
input |
( |
output |
( |
id_ref |
( |
id_comp |
( |
id_arm_var |
( |
data |
( |
arm_ref_comp |
( |
module |
( |
on_off |
( |
input_id |
( |
output_id |
( |
Value
Returns a shinyvalidate::InputValidator
which checks that there is at least one reference
and comparison arm
Parse text input to numeric vector
Description
Generic to parse text into numeric vectors. This was initially designed for a robust interpretation of text input in teal modules.
Usage
as_num(str)
## Default S3 method:
as_num(str)
## S3 method for class 'character'
as_num(str)
## S3 method for class 'numeric'
as_num(str)
## S3 method for class 'factor'
as_num(str)
## S3 method for class 'logical'
as_num(str)
Arguments
str |
( |
Details
The function is intended to extract any numeric from a character string, factor levels, boolean and return a vector of numeric.
Value
As vector of numeric if directly parsed from numeric
or boolean.
A list of numeric if parsed from a character string, each character string
associated with an list item.
Examples
dta <- list(
character = c("text10,20.5letter30.!", "!-.40$$-50e5[", NA),
factor = factor(c("]+60e-6, 7.7%%8L", "%90sep.100\"1L", NA_character_)),
numeric = c(1, -5e+2, NA),
logical = c(TRUE, FALSE, NA)
)
lapply(dta, as_num)
Expressions in Brackets
Description
Groups several expressions in a single bracketed expression.
Usage
bracket_expr(exprs)
Arguments
exprs |
( |
Value
a {
object. See base::Paren()
for details.
Examples
adsl <- tmc_ex_adsl
adrs <- tmc_ex_adrs
expr1 <- substitute(
expr = anl <- subset(df, PARAMCD == param),
env = list(df = as.name("adrs"), param = "INVET")
)
expr2 <- substitute(expr = anl$rsp_lab <- d_onco_rsp_label(anl$AVALC))
expr3 <- substitute(
expr = {
anl$is_rsp <- anl$rsp_lab %in%
c("Complete Response (CR)", "Partial Response (PR)")
}
)
res <- bracket_expr(list(expr1, expr2, expr3))
eval(res)
table(anl$rsp_lab, anl$is_rsp)
Concatenate expressions via a binary operator
Description
e.g. combine with +
for ggplot
without introducing parentheses due to associativity
Usage
call_concatenate(args, bin_op = "+")
Arguments
args |
arguments to concatenate with operator |
bin_op |
binary operator to concatenate it with |
Value
a call
Examples
library(ggplot2)
# What we want to achieve
call("+", quote(f), quote(g))
call("+", quote(f), call("+", quote(g), quote(h))) # parentheses not wanted
call("+", call("+", quote(f), quote(g)), quote(h)) # as expected without unnecessary parentheses
Reduce(function(existing, new) call("+", existing, new), list(quote(f), quote(g), quote(h)))
# how we do it
call_concatenate(list(quote(f), quote(g), quote(h)))
call_concatenate(list(quote(f)))
call_concatenate(list())
call_concatenate(
list(quote(ggplot(mtcars)), quote(geom_point(aes(wt, mpg))))
)
eval(
call_concatenate(
list(quote(ggplot(mtcars)), quote(geom_point(aes(wt, mpg))))
)
)
Check if the Treatment variable is reference or compare
Description
Usage
check_arm_ref_comp(x, df_to_check, module)
Arguments
x |
( |
df_to_check |
( |
module |
( |
Value
TRUE
or FALSE
whether the variable is in ref or comp
Clean up categorical variable description
Description
Cleaning categorical variable descriptions before presenting.
Usage
clean_description(x)
Arguments
x |
( |
Value
a string
Examples
clean_description("Level A (other text)")
clean_description("A long string that should be shortened")
Mapping function for Laboratory Table
Description
Map value and level characters to values with with proper html tags, colors and icons.
Usage
color_lab_values(
x,
classes = c("HIGH", "NORMAL", "LOW"),
colors = list(HIGH = "red", NORMAL = "grey", LOW = "blue"),
default_color = "black",
icons = list(HIGH = "glyphicon glyphicon-arrow-up", LOW =
"glyphicon glyphicon-arrow-down")
)
Arguments
x |
( |
classes |
( |
colors |
( |
default_color |
( |
icons |
( |
Value
a character vector where each element is a formatted HTML tag corresponding to
a value in x
.
Examples
color_lab_values(c("LOW", "LOW", "HIGH", "NORMAL", "HIGH"))
Get full label, useful for annotating plots
Description
Get full label, useful for annotating plots
Usage
column_annotation_label(dataset, column, omit_raw_name = FALSE)
Arguments
dataset |
( |
column |
( |
omit_raw_name |
( |
Value
"Label [Column name]
" if label exists, otherwise "Column name".
Examples
data <- mtcars
column_annotation_label(data, "cyl")
attr(data[["cyl"]], "label") <- "Cylinder"
column_annotation_label(data, "cyl")
column_annotation_label(data, "cyl", omit_raw_name = TRUE)
column_annotation_label(tmc_ex_adsl, "ACTARM")
Control Function for Time-To-Event teal Module
Description
Controls the arguments for Cox regression and survival analysis results.
Usage
control_tte(
surv_time = list(conf_level = 0.95, conf_type = "plain", quantiles = c(0.25, 0.75)),
coxph = list(pval_method = "log-rank", ties = "efron", conf_level = 0.95),
surv_timepoint = control_surv_timepoint(conf_level = 0.95, conf_type = c("plain",
"none", "log", "log-log"))
)
Arguments
surv_time |
( |
coxph |
( |
surv_timepoint |
( |
See Also
Convert choices_selected to data_extract_spec with only filter_spec
Description
Convert choices_selected to data_extract_spec with only filter_spec
Usage
cs_to_des_filter(
cs,
dataname,
multiple = FALSE,
include_vars = FALSE,
label = "Filter by"
)
Arguments
cs |
( |
dataname |
( |
multiple |
( |
include_vars |
( |
label |
( |
Value
(teal.transform::data_extract_spec()
)
Convert choices_selected to data_extract_spec with only select_spec
Description
Convert choices_selected to data_extract_spec with only select_spec
Usage
cs_to_des_select(
cs,
dataname,
multiple = FALSE,
ordered = FALSE,
label = "Select"
)
Arguments
cs |
( |
dataname |
( |
multiple |
( |
ordered |
( |
label |
( |
Value
(teal.transform::data_extract_spec()
)
Convert choices_selected to filter_spec
Description
Convert choices_selected to filter_spec
Usage
cs_to_filter_spec(cs, multiple = FALSE, label = "Filter by")
Arguments
cs |
( |
multiple |
( |
label |
( |
Value
(teal.transform::filter_spec()
)
Convert choices_selected to select_spec
Description
Convert choices_selected to select_spec
Usage
cs_to_select_spec(cs, multiple = FALSE, ordered = FALSE, label = "Select")
Arguments
cs |
( |
multiple |
( |
ordered |
( |
label |
( |
Value
(select_spec
)
Default string for total column label
Description
The default string used as a label for the "total" column. This value is used as the default
value for the total_label
argument throughout the teal.modules.clinical
package. If not specified
for each module by the user via the total_label
argument, or in the R environment options via
set_default_total_label()
, then "All Patients"
is used.
Usage
default_total_label()
set_default_total_label(total_label)
Arguments
total_label |
( |
Value
-
default_total_label
returns the current value if an R environment option has been set for"tmc_default_total_label"
, or"All Patients"
otherwise.
-
set_default_total_label
has no return value.
Functions
-
default_total_label()
: Getter for default total column label. -
set_default_total_label()
: Setter for default total column label. Sets the option"tmc_default_total_label"
within the R environment.
Examples
# Default settings
default_total_label()
getOption("tmc_default_total_label")
# Set custom value
set_default_total_label("All Patients")
# Settings after value has been set
default_total_label()
getOption("tmc_default_total_label")
Simulated CDISC
Data for Examples
Description
Simulated CDISC
Data for Examples
Usage
tmc_ex_adsl
tmc_ex_adae
tmc_ex_adaette
tmc_ex_adcm
tmc_ex_adeg
tmc_ex_adex
tmc_ex_adlb
tmc_ex_admh
tmc_ex_adqs
tmc_ex_adrs
tmc_ex_adtte
tmc_ex_advs
Format
rds
(data.frame
)
An object of class tbl_df
(inherits from tbl
, data.frame
) with 200 rows and 26 columns.
An object of class tbl_df
(inherits from tbl
, data.frame
) with 541 rows and 51 columns.
An object of class tbl_df
(inherits from tbl
, data.frame
) with 1800 rows and 35 columns.
An object of class tbl_df
(inherits from tbl
, data.frame
) with 512 rows and 45 columns.
An object of class tbl_df
(inherits from tbl
, data.frame
) with 5200 rows and 48 columns.
An object of class tbl_df
(inherits from tbl
, data.frame
) with 200 rows and 37 columns.
An object of class tbl_df
(inherits from tbl
, data.frame
) with 3000 rows and 58 columns.
An object of class tbl_df
(inherits from tbl
, data.frame
) with 1077 rows and 33 columns.
An object of class tbl_df
(inherits from tbl
, data.frame
) with 7000 rows and 36 columns.
An object of class tbl_df
(inherits from tbl
, data.frame
) with 1600 rows and 34 columns.
An object of class tbl_df
(inherits from tbl
, data.frame
) with 1000 rows and 34 columns.
An object of class tbl_df
(inherits from tbl
, data.frame
) with 8400 rows and 34 columns.
Functions
-
tmc_ex_adsl
:ADSL
data -
tmc_ex_adae
:ADAE
data -
tmc_ex_adaette
:ADAETTE
data -
tmc_ex_adcm
:ADCM
data -
tmc_ex_adeg
:ADEG
data -
tmc_ex_adex
:ADEX
data -
tmc_ex_adlb
:ADLB
data -
tmc_ex_admh
:ADMH
data -
tmc_ex_adqs
:ADQS
data -
tmc_ex_adrs
:ADRS
data -
tmc_ex_adtte
:ADTTE
data -
tmc_ex_advs
:ADVS
data
Extracts html id for data_extract_ui
Description
The data_extract_ui
is located under extended html id. We could not use ns("original id")
for reference, as it is extended with specific suffixes.
Usage
extract_input(varname, dataname, filter = FALSE)
Arguments
varname |
( |
dataname |
( |
filter |
( |
Value
a string
Examples
extract_input("ARM", "ADSL")
Facetting formula x_facet ~ y_facet
Description
Replaces
x_facet
or y_facet
by . when empty character
Usage
facet_grid_formula(x_facet, y_facet)
Arguments
x_facet |
( |
y_facet |
( |
Value
facet grid formula formula(x_facet ~ y_facet)
Utility function for extracting paramcd
for forest plots
Description
Utility function for extracting paramcd
for forest plots
Usage
get_g_forest_obj_var_name(paramcd, input, filter_idx = 1)
Arguments
paramcd |
|
input |
shiny app input |
filter_idx |
filter section index (default 1) |
Extract the associated parameter value for paramcd
Description
Utility function for extracting the parameter value that is associated
with the paramcd
value label. If there is no parameter value for
the paramcd
label, the paramcd
value is returned. This is used
for generating the title.
Usage
get_paramcd_label(anl, paramcd)
Arguments
anl |
Analysis dataset |
paramcd |
|
Get variable labels
Description
Usage
get_var_labels(datasets, dataname, vars)
Arguments
datasets |
( |
dataname |
( |
vars |
( |
Value
character
variable labels.
Expression Deparsing
Description
Deparse an expression into a string
.
Usage
h_concat_expr(expr)
Arguments
expr |
( |
Value
a string
.
Examples
expr <- quote({
library(rtables)
basic_table() %>%
split_cols_by(var = "ARMCD") %>%
test_proportion_diff(
vars = "rsp", method = "cmh", variables = list(strata = "strata")
) %>%
build_table(df = dta)
})
h_concat_expr(expr)
Whether object is of class teal.transform::choices_selected()
Description
Whether object is of class teal.transform::choices_selected()
Usage
is.cs_or_des(x)
Arguments
x |
object to be checked |
Value
(logical
)
ggplot2
call to generate simple bar chart
Description
ggplot2
call to generate simple bar chart
Usage
make_barchart_simple_call(
y_name,
x_name = NULL,
fill_name = NULL,
x_facet_name = NULL,
y_facet_name = NULL,
label_bars = TRUE,
barlayout = c("side_by_side", "stacked"),
flip_axis = FALSE,
rotate_bar_labels = FALSE,
rotate_x_label = FALSE,
rotate_y_label = FALSE,
expand_y_range = 0,
facet_scales = "free_x",
ggplot2_args = teal.widgets::ggplot2_args()
)
Arguments
y_name |
( |
x_name |
( |
fill_name |
( |
x_facet_name |
( |
y_facet_name |
( |
label_bars |
( |
barlayout |
( |
flip_axis |
( |
rotate_bar_labels |
( |
rotate_x_label |
( |
rotate_y_label |
( |
expand_y_range |
( |
facet_scales |
( |
ggplot2_args |
( |
Value
call
to produce a ggplot
object.
Standard Module Arguments
Description
The documentation to this function lists all the arguments in teal modules that are used repeatedly to express an analysis.
Arguments
arm_ref_comp |
( |
arm_var |
( |
atirel |
( |
aval_var |
( |
avalu_var |
( |
avisit |
( |
baseline_var |
( |
by_vars |
( |
cmdecod |
( |
cmindc |
( |
cmstdy |
( |
cnsr_var |
( |
conf_level |
( |
cov_var |
( |
dataname |
( |
default_responses |
( |
fixed_symbol_size |
( |
font_size |
( |
hlt |
( |
id_var |
( |
interact_var |
( |
interact_y |
( |
label |
( |
llt |
( |
paramcd |
( |
parentname |
( |
patient_col |
( |
plot_height |
( |
plot_width |
( |
post_output |
( |
pre_output |
( |
strata_var |
( |
summarize_vars |
( |
subgroup_var |
( |
time_points |
( |
time_unit_var |
( |
treatment_flag |
( |
treatment_flag_var |
( |
useNA |
( |
visit_var |
( |
worst_flag_indicator |
( |
worst_flag_var |
( |
decorators |
See section "Decorating Module" below for more details. |
Details
Although this function just returns
NULL
it has two uses, for the teal module users it provides a documentation of arguments that are commonly and consistently used in the framework. For the developer it adds a single reference point to import theroxygen
argument description with:@inheritParams module_arguments
Parameters with identical descriptions & input types to those in the Standard Template Arguments section are excluded to reduce duplication as each module function inherits parameters from its corresponding template function.
Value
a teal_module
object.
See Also
The TLG Catalog where additional example apps implementing this module can be found.
Expressions as a Pipeline
Description
Concatenate expressions in a single pipeline-flavor expression.
Usage
pipe_expr(exprs, pipe_str = "%>%")
Arguments
exprs |
( |
pipe_str |
( |
Value
a call
Examples
pipe_expr(
list(
expr1 = substitute(df),
expr2 = substitute(head)
)
)
Expression: Arm Preparation
Description
The function generate the standard expression for pre-processing of dataset
in teal module applications. This is especially of interest when the same
preprocessing steps needs to be applied similarly to several datasets
(e.g. ADSL
and ADRS
).
Usage
prepare_arm(
dataname,
arm_var,
ref_arm,
comp_arm,
compare_arm = !is.null(ref_arm),
ref_arm_val = paste(ref_arm, collapse = "/"),
drop = TRUE
)
Arguments
dataname |
( |
arm_var |
( |
ref_arm |
( |
comp_arm |
( |
compare_arm |
( |
ref_arm_val |
( |
drop |
( |
Details
In teal.modules.clinical
, the user interface includes manipulation of
the study arms. Classically: the arm variable itself (e.g. ARM
, ACTARM
),
the reference arm (0 or more), the comparison arm (1 or more) and the
possibility to combine comparison arms.
Note that when no arms should be compared with each other, then the produced expression is reduced to optionally dropping non-represented levels of the arm.
When comparing arms, the pre-processing includes three steps:
Filtering of the dataset to retain only the arms of interest (reference and comparison).
Optional, if more than one arm is designated as reference they are combined into a single level.
The reference is explicitly reassigned and the non-represented levels of arm are dropped.
Value
a call
Examples
prepare_arm(
dataname = "adrs",
arm_var = "ARMCD",
ref_arm = "ARM A",
comp_arm = c("ARM B", "ARM C")
)
prepare_arm(
dataname = "adsl",
arm_var = "ARMCD",
ref_arm = c("ARM B", "ARM C"),
comp_arm = "ARM A"
)
Expression: Prepare Arm Levels
Description
This function generates the standard expression for pre-processing of dataset arm levels in and is used to apply the same steps in safety teal modules.
Usage
prepare_arm_levels(dataname, parentname, arm_var, drop_arm_levels = TRUE)
Arguments
dataname |
( |
parentname |
( |
arm_var |
( |
drop_arm_levels |
( |
Value
a {
object. See base::Paren()
for details.
Examples
prepare_arm_levels(
dataname = "adae",
parentname = "adsl",
arm_var = "ARMCD",
drop_arm_levels = TRUE
)
prepare_arm_levels(
dataname = "adae",
parentname = "adsl",
arm_var = "ARMCD",
drop_arm_levels = FALSE
)
Subset decorators based on the scope
Description
Subset decorators based on the scope
Usage
select_decorators(decorators, scope)
Arguments
decorators |
(named |
scope |
( |
Value
Subsetted list with all decorators to include.
It can be an empty list if none of the scope exists in decorators
argument.
Split choices_selected
objects with interactions into
their component variables
Description
Split choices_selected
objects with interactions into
their component variables
Usage
split_choices(x)
Arguments
x |
( |
Value
a teal.transform::choices_selected()
object.
Note
uses the regex \\*|:
to perform the split.
Examples
split_choices(choices_selected(choices = c("x:y", "a*b"), selected = all_choices()))
Split-Column Expression
Description
Renders the expression for column split in rtables
depending on:
the expected or not arm comparison
the expected or not arm combination
Usage
split_col_expr(compare, combine, ref, arm_var)
Arguments
compare |
( |
combine |
( |
ref |
( |
arm_var |
( |
Value
a call
Examples
split_col_expr(
compare = TRUE,
combine = FALSE,
ref = "ARM A",
arm_var = "ARMCD"
)
Split interaction terms into their component variables
Description
Split interaction terms into their component variables
Usage
split_interactions(x, by = "\\*|:")
Arguments
x |
( |
by |
( |
Value
a vector of strings where each element is a component
variable extracted from interaction term x
.
Examples
split_interactions("x:y")
split_interactions("x*y")
Wrappers around srv_transform_teal_data
that allows to decorate the data
Description
Wrappers around srv_transform_teal_data
that allows to decorate the data
Usage
srv_decorate_teal_data(id, data, decorators, expr, expr_is_reactive = FALSE)
ui_decorate_teal_data(id, decorators, ...)
Arguments
id |
( |
data |
( |
expr |
( |
expr_is_reactive |
( |
Details
srv_decorate_teal_data
is a wrapper around srv_transform_teal_data
that
allows to decorate the data with additional expressions.
When original teal_data
object is in error state, it will show that error
first.
ui_decorate_teal_data
is a wrapper around ui_transform_teal_data
.
Substitute Names in a Quoted Expression
Description
This function substitutes the names on both left- and right-hand sides in a quoted expression. In addition it can also do other standard substitutions on the right-hand side.
Usage
substitute_names(expr, names, others = list())
h_subst_lhs_names(qexpr, names)
substitute_lhs_names(qexpr, names)
substitute_rhs(qexpr, env)
Arguments
expr |
( |
names |
(named |
others |
(named |
qexpr |
( |
env |
( |
Value
The modified expression.
Functions
-
h_subst_lhs_names()
: Helper function to just substitute the top-level names on the left-hand side in a quoted expression. -
substitute_lhs_names()
: recursively substitutes all names on the left-hand sides in a quoted expression. -
substitute_rhs()
: substitutes on the right-hand side in a quoted expression. Note that this is just a synonym forsubstitute_q()
.
See Also
Substitute in Quoted Expressions
Description
This version of substitute is needed because substitute()
does not
evaluate it's first argument, and it's often useful to be able to modify
a quoted expression.
Usage
substitute_q(qexpr, env)
Arguments
qexpr |
( |
env |
( |
Value
The modified expression.
Note
This is simplified from the package pryr
to avoid another dependency.
See Also
Template for Generalized Estimating Equations (GEE) analysis module
Description
Creates a valid expression to generate an analysis table using Generalized Estimating Equations (GEE).
Usage
template_a_gee(
output_table,
data_model_fit = "ANL",
dataname_lsmeans = "ANL_ADSL",
input_arm_var = "ARM",
ref_group = "A: Drug X",
aval_var,
id_var,
arm_var,
visit_var,
split_covariates,
cor_struct,
conf_level = 0.95,
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
output_table |
( |
data_model_fit |
( |
dataname_lsmeans |
( |
aval_var |
( |
id_var |
( |
arm_var |
( |
visit_var |
( |
split_covariates |
( |
cor_struct |
( |
conf_level |
( |
basic_table_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Abnormality Summary Table
Description
Creates a valid expression to generate a table to summarize abnormality.
Usage
template_abnormality(
parentname,
dataname,
arm_var,
id_var = "USUBJID",
by_vars,
abnormal = list(low = c("LOW", "LOW LOW"), high = c("HIGH", "HIGH HIGH")),
grade = "ANRIND",
baseline_var = "BNRIND",
treatment_flag_var = "ONTRTFL",
treatment_flag = "Y",
add_total = FALSE,
total_label = default_total_label(),
exclude_base_abn = FALSE,
drop_arm_levels = TRUE,
na_level = default_na_str(),
basic_table_args = teal.widgets::basic_table_args(),
tbl_title
)
Arguments
parentname |
( |
dataname |
( |
arm_var |
( |
id_var |
( |
by_vars |
( |
abnormal |
( |
grade |
( |
baseline_var |
( |
treatment_flag_var |
( |
treatment_flag |
( |
add_total |
( |
total_label |
( |
exclude_base_abn |
( |
drop_arm_levels |
( |
na_level |
( |
basic_table_args |
( |
tbl_title |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Laboratory test results with highest grade post-baseline
Description
Creates a valid expression to generate a table to summarize abnormality by grade.
Usage
template_abnormality_by_worst_grade(
parentname,
dataname,
arm_var,
id_var = "USUBJID",
paramcd = "PARAMCD",
atoxgr_var = "ATOXGR",
worst_high_flag_var = "WGRHIFL",
worst_low_flag_var = "WGRLOFL",
worst_flag_indicator = "Y",
add_total = FALSE,
total_label = default_total_label(),
drop_arm_levels = TRUE,
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
parentname |
( |
dataname |
( |
arm_var |
( |
id_var |
( |
paramcd |
( |
atoxgr_var |
( |
worst_high_flag_var |
( |
worst_low_flag_var |
( |
worst_flag_indicator |
( |
add_total |
( |
total_label |
( |
drop_arm_levels |
( |
basic_table_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
tm_t_abnormality_by_worst_grade()
Template: Patient Profile Adverse Events Table and Plot
Description
Creates a valid expression to generate an adverse events table and ggplot2::ggplot()
plot using ADaM datasets.
Usage
template_adverse_events(
dataname = "ANL",
aeterm = "AETERM",
tox_grade = "AETOXGR",
causality = "AEREL",
outcome = "AEOUT",
action = "AEACN",
time = "ASTDY",
decod = NULL,
patient_id,
font_size = 12L,
ggplot2_args = teal.widgets::ggplot2_args()
)
Arguments
dataname |
( |
aeterm |
( |
tox_grade |
( |
causality |
( |
outcome |
( |
action |
( |
time |
( |
decod |
( |
patient_id |
( |
font_size |
( |
ggplot2_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: ANCOVA Summary
Description
Creates a valid expression to generate an analysis of variance summary table.
Usage
template_ancova(
dataname = "ANL",
parentname = "ADSL",
arm_var,
ref_arm = NULL,
comp_arm = NULL,
combine_comp_arms = FALSE,
aval_var,
label_aval = NULL,
cov_var,
include_interact = FALSE,
interact_var = NULL,
interact_y = FALSE,
paramcd_levels = "",
paramcd_var = "PARAMCD",
label_paramcd = NULL,
visit_levels = "",
visit_var = "AVISIT",
conf_level = 0.95,
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
dataname |
( |
parentname |
( |
arm_var |
( |
ref_arm |
( |
comp_arm |
( |
combine_comp_arms |
( |
aval_var |
( |
label_aval |
( |
cov_var |
( |
include_interact |
( |
interact_var |
( |
interact_y |
( |
paramcd_levels |
( |
paramcd_var |
( |
label_paramcd |
( |
visit_levels |
( |
visit_var |
( |
conf_level |
( |
basic_table_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Standard Template Arguments
Description
The documentation to this function lists all the arguments in teal module templates that are used repeatedly to express an analysis.
Arguments
add_total |
( |
anl_name |
( |
arm_var |
( |
atirel |
( |
aval |
|
avalu |
|
avalu_var |
( |
aval_var |
( |
baseline_var |
( |
base_var |
|
basic_table_args |
( |
by_vars |
( |
cmdecod |
( |
cmindc |
( |
cmstdy |
( |
cnsr_var |
( |
combine_comp_arms |
( |
compare_arm |
( |
comp_arm |
( |
conf_level |
( |
control |
( |
cov_var |
( |
dataname |
( |
denominator |
( |
drop_arm_levels |
( |
event_type |
( |
font_size |
( |
ggplot2_args |
( |
hlt |
( |
id_var |
( |
include_interact |
( |
label_hlt |
( |
label_llt |
( |
llt |
( |
na_level |
( |
na.rm |
( |
numeric_stats |
( |
paramcd |
( |
parentname |
( |
patient_id |
( |
prune_diff |
( |
prune_freq |
( |
ref_arm |
( |
sort_criteria |
( |
strata_var |
( |
subgroup_var |
( |
sum_vars |
( |
time_points |
( |
time_unit_var |
( |
title |
( |
total_label |
( |
treatment_flag |
( |
treatment_flag_var |
( |
useNA |
( |
var_labels |
(named |
visit_var |
( |
worst_flag_indicator |
( |
worst_flag_var |
( |
Details
Although this function just returns NULL
it has two uses, for
the teal module users it provides a documentation of arguments that are
commonly and consistently used in the framework. For the developer it adds a
single reference point to import the roxygen
argument description with:
@inheritParams template_arguments
Value
a list
of expressions to generate a table or plot object.
Template: Patient Profile Basic Info
Description
Creates a valid expression to generate a patient profile basic info report using ADaM datasets.
Usage
template_basic_info(dataname = "ANL", vars, patient_id = NULL)
Arguments
dataname |
( |
vars |
( |
patient_id |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Binary Outcome
Description
Creates a valid expression to generate a binary outcome analysis.
Usage
template_binary_outcome(
dataname,
parentname,
arm_var,
paramcd,
ref_arm = NULL,
comp_arm = NULL,
compare_arm = FALSE,
combine_comp_arms = FALSE,
aval_var = "AVALC",
show_rsp_cat = TRUE,
responder_val = c("Complete Response (CR)", "Partial Response (PR)"),
responder_val_levels = responder_val,
control = list(global = list(method = "waldcc", conf_level = 0.95), unstrat =
list(method_ci = "waldcc", method_test = "schouten", odds = TRUE), strat =
list(method_ci = "cmh", method_test = "cmh", strat = NULL)),
add_total = FALSE,
total_label = default_total_label(),
na_level = default_na_str(),
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
dataname |
( |
parentname |
( |
arm_var |
( |
paramcd |
( |
ref_arm |
( |
comp_arm |
( |
compare_arm |
( |
combine_comp_arms |
( |
aval_var |
( |
show_rsp_cat |
( |
responder_val |
( |
responder_val_levels |
( |
control |
( |
add_total |
( |
total_label |
( |
na_level |
( |
basic_table_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Multi-Variable Cox Regression
Description
Creates a valid expression to generate a multi-variable Cox regression analysis.
Usage
template_coxreg_m(
dataname,
cov_var,
arm_var,
cnsr_var,
aval_var,
ref_arm,
comp_arm,
paramcd,
at = list(),
strata_var = NULL,
combine_comp_arms = FALSE,
control = control_coxreg(),
na_level = default_na_str(),
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
dataname |
( |
cov_var |
( |
arm_var |
( |
cnsr_var |
( |
aval_var |
( |
ref_arm |
( |
comp_arm |
( |
paramcd |
( |
at |
( |
strata_var |
( |
combine_comp_arms |
( |
control |
( |
na_level |
( |
basic_table_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
template_coxreg_u()
, tm_t_coxreg()
Template: Univariable Cox Regression
Description
Creates a valid expression to generate a univariable Cox regression analysis.
Usage
template_coxreg_u(
dataname,
cov_var,
arm_var,
cnsr_var,
aval_var,
ref_arm,
comp_arm,
paramcd,
at = list(),
strata_var = NULL,
combine_comp_arms = FALSE,
control = control_coxreg(),
na_level = default_na_str(),
append = FALSE,
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
dataname |
( |
cov_var |
( |
arm_var |
( |
cnsr_var |
( |
aval_var |
( |
ref_arm |
( |
comp_arm |
( |
paramcd |
( |
at |
( |
strata_var |
( |
combine_comp_arms |
( |
control |
( |
na_level |
( |
append |
( |
basic_table_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
template_coxreg_m()
, tm_t_coxreg()
Template: Events by Term
Description
Creates a valid expression to generate a table of events by term.
Usage
template_events(
dataname,
parentname,
arm_var,
hlt,
llt,
label_hlt = NULL,
label_llt = NULL,
add_total = TRUE,
total_label = default_total_label(),
na_level = default_na_str(),
event_type = "event",
sort_criteria = c("freq_desc", "alpha"),
sort_freq_col = total_label,
prune_freq = 0,
prune_diff = 0,
drop_arm_levels = TRUE,
incl_overall_sum = TRUE,
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
dataname |
( |
parentname |
( |
arm_var |
( |
hlt |
( |
llt |
( |
label_hlt |
( |
label_llt |
( |
add_total |
( |
total_label |
( |
na_level |
( |
event_type |
( |
sort_criteria |
( |
sort_freq_col |
( |
prune_freq |
( |
prune_diff |
( |
drop_arm_levels |
( |
incl_overall_sum |
( |
basic_table_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Events by Grade
Description
Creates a valid expression to generate a table to summarize events by grade.
Usage
template_events_by_grade(
dataname,
parentname,
arm_var,
id = "",
hlt,
llt,
label_hlt = NULL,
label_llt = NULL,
grade,
label_grade = NULL,
prune_freq = 0,
prune_diff = 0,
add_total = TRUE,
total_label = default_total_label(),
na_level = default_na_str(),
drop_arm_levels = TRUE,
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
dataname |
( |
parentname |
( |
arm_var |
( |
id |
( |
hlt |
( |
llt |
( |
label_hlt |
( |
label_llt |
( |
grade |
( |
label_grade |
( |
prune_freq |
( |
prune_diff |
( |
add_total |
( |
total_label |
( |
na_level |
( |
drop_arm_levels |
( |
basic_table_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Adverse Events Grouped by Grade with Threshold
Description
Creates a valid expression to generate a table to summarize adverse events grouped by grade.
Usage
template_events_col_by_grade(
dataname,
parentname,
arm_var,
grading_groups = list(`Any Grade (%)` = c("1", "2", "3", "4", "5"), `Grade 1-2 (%)` =
c("1", "2"), `Grade 3-4 (%)` = c("3", "4"), `Grade 5 (%)` = "5"),
add_total = TRUE,
total_label = default_total_label(),
id = "USUBJID",
hlt,
llt,
label_hlt = NULL,
label_llt = NULL,
grade = "AETOXGR",
label_grade = NULL,
prune_freq = 0.1,
prune_diff = 0,
na_level = default_na_str(),
drop_arm_levels = TRUE,
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
dataname |
( |
parentname |
( |
arm_var |
( |
grading_groups |
( |
add_total |
( |
total_label |
( |
id |
( |
hlt |
( |
llt |
( |
label_hlt |
( |
label_llt |
( |
grade |
( |
label_grade |
( |
prune_freq |
( |
prune_diff |
( |
na_level |
( |
drop_arm_levels |
( |
basic_table_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Event Rates Adjusted for Patient-Years
Description
Creates a valid expression to generate a table of event rates adjusted for patient-years.
Usage
template_events_patyear(
dataname,
parentname,
arm_var,
events_var,
label_paramcd,
aval_var = "AVAL",
add_total = TRUE,
total_label = default_total_label(),
na_level = default_na_str(),
control = control_incidence_rate(),
drop_arm_levels = TRUE,
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
dataname |
( |
parentname |
( |
arm_var |
( |
events_var |
( |
label_paramcd |
( |
aval_var |
( |
add_total |
( |
total_label |
( |
na_level |
( |
control |
( |
drop_arm_levels |
( |
basic_table_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Adverse Events Summary
Description
Creates a valid expression to generate an adverse events summary table.
Usage
template_events_summary(
anl_name,
parentname,
arm_var,
dthfl_var = "DTHFL",
dcsreas_var = "DCSREAS",
flag_var_anl = NULL,
flag_var_aesi = NULL,
aeseq_var = "AESEQ",
llt = "AEDECOD",
add_total = TRUE,
total_label = default_total_label(),
na_level = default_na_str(),
count_dth = TRUE,
count_wd = TRUE,
count_subj = TRUE,
count_pt = TRUE,
count_events = TRUE
)
Arguments
anl_name |
( |
parentname |
( |
arm_var |
( |
dthfl_var |
( |
dcsreas_var |
( |
flag_var_anl |
( |
flag_var_aesi |
( |
aeseq_var |
( |
llt |
( |
add_total |
( |
total_label |
( |
na_level |
( |
count_dth |
( |
count_wd |
( |
count_subj |
( |
count_pt |
( |
count_events |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Exposure Table for Risk management plan
Description
Creates a valid expression to generate exposure table for risk management plan.
Usage
template_exposure(
parentname,
dataname,
id_var,
paramcd,
paramcd_label = NULL,
row_by_var,
col_by_var = NULL,
add_total = FALSE,
total_label = "Total",
add_total_row = TRUE,
total_row_label = "Total number of patients and patient time*",
drop_levels = TRUE,
na_level = default_na_str(),
aval_var,
avalu_var,
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
parentname |
( |
dataname |
( |
id_var |
( |
paramcd |
( |
paramcd_label |
( |
row_by_var |
( |
col_by_var |
( |
add_total |
( |
total_label |
( |
add_total_row |
( |
total_row_label |
( |
drop_levels |
( |
na_level |
( |
aval_var |
( |
avalu_var |
( |
basic_table_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Mixed Model Repeated Measurements (MMRM) Analysis
Description
Creates a valid expression to generate analysis tables and plots for Mixed Model Repeated Measurements.
Usage
template_fit_mmrm(
parentname,
dataname,
aval_var,
arm_var,
ref_arm,
comp_arm = NULL,
combine_comp_arms = FALSE,
id_var,
visit_var,
cov_var,
conf_level = 0.95,
method = "Satterthwaite",
cor_struct = "unstructured",
weights_emmeans = "proportional",
parallel = FALSE
)
template_mmrm_tables(
parentname,
dataname,
fit_name,
arm_var,
ref_arm,
visit_var,
paramcd,
show_relative = c("increase", "reduction", "none"),
table_type = "t_mmrm_cov",
total_label = default_total_label(),
basic_table_args = teal.widgets::basic_table_args()
)
template_mmrm_plots(
fit_name,
lsmeans_plot = list(select = c("estimates", "contrasts"), width = 0.6, show_pval =
FALSE),
diagnostic_plot = list(type = "fit-residual", z_threshold = NULL),
ggplot2_args = teal.widgets::ggplot2_args()
)
Arguments
parentname |
( |
dataname |
( |
aval_var |
( |
arm_var |
( |
ref_arm |
( |
comp_arm |
( |
combine_comp_arms |
( |
id_var |
( |
visit_var |
( |
cov_var |
( |
conf_level |
( |
method |
( |
cor_struct |
( |
weights_emmeans |
argument from |
parallel |
( |
fit_name |
( |
paramcd |
( |
show_relative |
( |
table_type |
( |
total_label |
( |
basic_table_args |
( |
lsmeans_plot |
(named |
diagnostic_plot |
(named |
ggplot2_args |
( |
Value
a list
of expressions to generate a table or plot object.
Functions
-
template_mmrm_tables()
: Creates valid expressions to generate MMRM LS means, covariance matrix, fixed effects, and diagnostic tables. -
template_mmrm_plots()
: Creates valid expressions to generate MMRM LS means and diagnostic plots.
See Also
Template: Response Forest Plot
Description
Creates a valid expression to generate a response forest plot.
Usage
template_forest_rsp(
dataname = "ANL",
parentname = "ADSL",
arm_var,
ref_arm = NULL,
comp_arm = NULL,
obj_var_name = "",
aval_var = "AVALC",
responders = c("CR", "PR"),
subgroup_var,
strata_var = NULL,
stats = c("n_tot", "n", "n_rsp", "prop", "or", "ci"),
riskdiff = NULL,
conf_level = 0.95,
col_symbol_size = NULL,
font_size = 15,
ggplot2_args = teal.widgets::ggplot2_args()
)
Arguments
dataname |
( |
parentname |
( |
arm_var |
( |
ref_arm |
( |
comp_arm |
( |
obj_var_name |
( |
aval_var |
( |
responders |
( |
subgroup_var |
( |
strata_var |
( |
stats |
(
|
riskdiff |
( |
conf_level |
( |
col_symbol_size |
( |
font_size |
( |
ggplot2_args |
( For more details, see the vignette: |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Survival Forest Plot
Description
Creates a valid expression to generate a survival forest plot.
Usage
template_forest_tte(
dataname = "ANL",
parentname = "ANL_ADSL",
arm_var,
ref_arm = NULL,
comp_arm = NULL,
obj_var_name = "",
aval_var = "AVAL",
cnsr_var = "CNSR",
subgroup_var,
strata_var = NULL,
stats = c("n_tot_events", "n_events", "median", "hr", "ci"),
riskdiff = NULL,
conf_level = 0.95,
col_symbol_size = NULL,
time_unit_var = "AVALU",
font_size = 15,
ggplot2_args = teal.widgets::ggplot2_args()
)
Arguments
dataname |
( |
parentname |
( |
arm_var |
( |
ref_arm |
( |
comp_arm |
( |
obj_var_name |
( |
aval_var |
( |
cnsr_var |
( |
subgroup_var |
( |
strata_var |
( |
stats |
(
|
riskdiff |
( |
conf_level |
( |
col_symbol_size |
( |
time_unit_var |
( |
font_size |
( |
ggplot2_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Confidence Interval Plot
Description
Creates a valid expression to generate a ggplot2::ggplot()
confidence interval plot.
Usage
template_g_ci(
dataname,
x_var,
y_var,
grp_var = NULL,
stat = c("mean", "median"),
conf_level = 0.95,
unit_var = "AVALU",
ggplot2_args = teal.widgets::ggplot2_args()
)
Arguments
dataname |
( |
x_var |
( |
y_var |
( |
grp_var |
( |
stat |
( |
conf_level |
( |
unit_var |
( |
ggplot2_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Individual Patient Plots
Description
Creates a valid expression to generate ggplot2::ggplot()
plots of individual patients.
Usage
template_g_ipp(
dataname = "ANL",
paramcd,
arm_var,
arm_levels,
avalu_first,
paramcd_first,
aval_var = "AVAL",
avalu_var = "AVALU",
id_var = "USUBJID",
visit_var = "AVISIT",
base_var = lifecycle::deprecated(),
baseline_var = "BASE",
add_baseline_hline = FALSE,
separate_by_obs = FALSE,
ggplot2_args = teal.widgets::ggplot2_args(),
suppress_legend = FALSE,
add_avalu = TRUE
)
Arguments
dataname |
( |
paramcd |
( |
arm_var |
( |
arm_levels |
( |
avalu_first |
( |
paramcd_first |
( |
aval_var |
( |
avalu_var |
( |
id_var |
( |
visit_var |
( |
base_var |
|
baseline_var |
( |
add_baseline_hline |
( |
separate_by_obs |
( |
ggplot2_args |
( For more details, see the vignette: |
suppress_legend |
( |
add_avalu |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Kaplan-Meier Plot
Description
Creates a valid expression to generate a Kaplan-Meier plot.
Usage
template_g_km(
dataname = "ANL",
arm_var = "ARM",
ref_arm = NULL,
comp_arm = NULL,
compare_arm = FALSE,
combine_comp_arms = FALSE,
aval_var = "AVAL",
cnsr_var = "CNSR",
xticks = NULL,
strata_var = NULL,
time_points = NULL,
facet_var = "SEX",
font_size = 11,
conf_level = 0.95,
ties = "efron",
xlab = "Survival time",
time_unit_var = "AVALU",
yval = "Survival",
ylim = NULL,
pval_method = "log-rank",
annot_surv_med = TRUE,
annot_coxph = TRUE,
control_annot_surv_med = control_surv_med_annot(),
control_annot_coxph = control_coxph_annot(x = 0.27, y = 0.35, w = 0.3),
legend_pos = NULL,
position_coxph = lifecycle::deprecated(),
width_annots = lifecycle::deprecated(),
rel_height_plot = 0.8,
ci_ribbon = FALSE,
title = "KM Plot"
)
Arguments
dataname |
( |
arm_var |
( |
ref_arm |
( |
comp_arm |
( |
compare_arm |
( |
combine_comp_arms |
( |
aval_var |
( |
cnsr_var |
( |
xticks |
( |
strata_var |
( |
time_points |
( |
facet_var |
( |
font_size |
( |
conf_level |
( |
ties |
( |
xlab |
( |
time_unit_var |
( |
yval |
( |
ylim |
( |
pval_method |
( |
annot_surv_med |
( |
annot_coxph |
( |
control_annot_surv_med |
( |
control_annot_coxph |
( |
legend_pos |
( |
position_coxph |
|
width_annots |
|
rel_height_plot |
( |
ci_ribbon |
( |
title |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Line Plot
Description
Creates a valid expression to generate a ggplot2::ggplot()
line plot.
Usage
template_g_lineplot(
dataname = "ANL",
strata = lifecycle::deprecated(),
group_var = "ARM",
x = "AVISIT",
y = "AVAL",
y_unit = "AVALU",
paramcd = "PARAMCD",
param = "ALT",
mid = "mean",
interval = "mean_ci",
whiskers = c("mean_ci_lwr", "mean_ci_upr"),
table = c("n", "mean_sd", "median", "range"),
mid_type = "pl",
conf_level = 0.95,
incl_screen = TRUE,
mid_point_size = 2,
table_font_size = 4,
title = "Line Plot",
y_lab = "",
ggplot2_args = teal.widgets::ggplot2_args()
)
Arguments
dataname |
( |
strata |
|
group_var |
( |
x |
( |
y |
( |
y_unit |
( |
paramcd |
( |
param |
( |
mid |
( |
interval |
( |
whiskers |
( |
table |
( |
mid_type |
( |
conf_level |
( |
incl_screen |
( |
mid_point_size |
( |
table_font_size |
( |
title |
( |
y_lab |
( |
ggplot2_args |
( For more details, see the vignette: |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Patient Profile Laboratory Table
Description
Creates a valid expression to generate a patient profile laboratory table using ADaM datasets.
Usage
template_laboratory(
dataname = "ANL",
paramcd = "PARAMCD",
param = "PARAM",
anrind = "ANRIND",
timepoints = "ADY",
aval = lifecycle::deprecated(),
aval_var = "AVAL",
avalu = lifecycle::deprecated(),
avalu_var = "AVALU",
patient_id = NULL,
round_value = 0L
)
Arguments
dataname |
( |
paramcd |
( |
param |
( |
anrind |
( |
timepoints |
( |
aval |
|
aval_var |
( |
avalu |
|
avalu_var |
( |
patient_id |
( |
round_value |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Logistic Regression
Description
Creates a valid expression to generate a logistic regression table.
Usage
template_logistic(
dataname,
arm_var,
aval_var,
paramcd = lifecycle::deprecated(),
label_paramcd,
cov_var,
interaction_var,
ref_arm,
comp_arm,
topleft = "Logistic Regression",
conf_level = 0.95,
combine_comp_arms = FALSE,
responder_val = c("CR", "PR"),
at = NULL,
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
dataname |
( |
arm_var |
( |
aval_var |
( |
paramcd |
|
label_paramcd |
( |
cov_var |
( |
interaction_var |
( |
ref_arm |
( |
comp_arm |
( |
topleft |
( |
conf_level |
( |
combine_comp_arms |
( |
responder_val |
( |
at |
( |
basic_table_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Patient Profile Medical History
Description
Creates a valid expression to generate a patient profile medical history report using ADaM datasets.
Usage
template_medical_history(
dataname = "ANL",
mhterm = "MHTERM",
mhbodsys = "MHBODSYS",
mhdistat = "MHDISTAT",
patient_id = NULL
)
Arguments
dataname |
( |
mhterm |
( |
mhbodsys |
( |
mhdistat |
( |
patient_id |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Multiple Events by Term
Description
Creates a valid expression to generate a table of multiple events by term.
Usage
template_mult_events(
dataname,
parentname,
arm_var,
seq_var,
hlt,
llt,
add_total = TRUE,
total_label = default_total_label(),
na_level = default_na_str(),
event_type = "event",
drop_arm_levels = TRUE,
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
dataname |
( |
parentname |
( |
arm_var |
( |
seq_var |
( |
hlt |
( |
llt |
( |
add_total |
( |
total_label |
( |
na_level |
( |
event_type |
( |
drop_arm_levels |
( |
basic_table_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Patient Profile Timeline Plot
Description
Creates a valid expression to generate a patient profile timeline ggplot2::ggplot()
plot using ADaM datasets.
Usage
template_patient_timeline(
dataname = "ANL",
aeterm = "AETERM",
aetime_start = "ASTDTM",
aetime_end = "AENDTM",
dstime_start = "CMASTDTM",
dstime_end = "CMAENDTM",
cmdecod = "CMDECOD",
aerelday_start = NULL,
aerelday_end = NULL,
dsrelday_start = NULL,
dsrelday_end = NULL,
relative_day = FALSE,
patient_id,
font_size = 12L,
ggplot2_args = teal.widgets::ggplot2_args()
)
Arguments
dataname |
( |
aeterm |
( |
aetime_start |
( |
aetime_end |
( |
dstime_start |
( |
dstime_end |
( |
cmdecod |
( |
aerelday_start |
( |
aerelday_end |
( |
dsrelday_start |
( |
dsrelday_end |
( |
relative_day |
( |
patient_id |
( |
font_size |
( |
ggplot2_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Patient Profile Prior Medication
Description
Creates a valid expression to generate a patient profile prior medication report using ADaM datasets.
Usage
template_prior_medication(
dataname = "ANL",
atirel = "ATIREL",
cmdecod = "CMDECOD",
cmindc = "CMINDC",
cmstdy = "CMSTDY"
)
Arguments
dataname |
( |
atirel |
( |
cmdecod |
( |
cmindc |
( |
cmstdy |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Shift by Arm
Description
Creates a valid expression to generate a summary table of analysis indicator levels by arm.
Usage
template_shift_by_arm(
dataname,
parentname,
arm_var = "ARM",
paramcd = "PARAMCD",
visit_var = "AVISIT",
treatment_flag_var = "ONTRTFL",
treatment_flag = "Y",
aval_var = "ANRIND",
base_var = lifecycle::deprecated(),
baseline_var = "BNRIND",
na.rm = FALSE,
na_level = default_na_str(),
add_total = FALSE,
total_label = default_total_label(),
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
dataname |
( |
parentname |
( |
arm_var |
( |
paramcd |
( |
visit_var |
( |
treatment_flag_var |
( |
treatment_flag |
( |
aval_var |
( |
base_var |
|
baseline_var |
( |
na.rm |
( |
na_level |
( |
add_total |
( |
total_label |
( |
basic_table_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Shift by Arm by Worst Analysis Indicator Level
Description
Creates a valid expression to generate a summary table of worst analysis indicator variable level per subject by arm.
Usage
template_shift_by_arm_by_worst(
dataname,
parentname,
arm_var = "ARM",
paramcd = "PARAMCD",
worst_flag_var = "WORS02FL",
worst_flag = "Y",
treatment_flag_var = "ONTRTFL",
treatment_flag = "Y",
aval_var = "ANRIND",
base_var = lifecycle::deprecated(),
baseline_var = "BNRIND",
na.rm = FALSE,
na_level = default_na_str(),
add_total = FALSE,
total_label = default_total_label(),
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
dataname |
( |
parentname |
( |
arm_var |
( |
paramcd |
( |
worst_flag_var |
( |
worst_flag |
( |
treatment_flag_var |
( |
treatment_flag |
( |
aval_var |
( |
base_var |
|
baseline_var |
( |
na.rm |
( |
na_level |
( |
add_total |
( |
total_label |
( |
basic_table_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Grade Summary Table
Description
Creates a valid expression to generate a grade summary table.
Usage
template_shift_by_grade(
parentname,
dataname,
arm_var = "ARM",
id_var = "USUBJID",
visit_var = "AVISIT",
worst_flag_var = c("WGRLOVFL", "WGRLOFL", "WGRHIVFL", "WGRHIFL"),
worst_flag_indicator = "Y",
anl_toxgrade_var = "ATOXGR",
base_toxgrade_var = "BTOXGR",
paramcd = "PARAMCD",
drop_arm_levels = TRUE,
add_total = FALSE,
total_label = default_total_label(),
na_level = default_na_str(),
code_missing_baseline = FALSE,
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
parentname |
( |
dataname |
( |
arm_var |
( |
id_var |
( |
visit_var |
( |
worst_flag_var |
( |
worst_flag_indicator |
( |
anl_toxgrade_var |
( |
base_toxgrade_var |
( |
paramcd |
( |
drop_arm_levels |
( |
add_total |
( |
total_label |
( |
na_level |
( |
code_missing_baseline |
( |
basic_table_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Adverse Events Table by Standardized MedDRA Query
Description
Creates a valid expression to generate an adverse events table by Standardized MedDRA Query.
Usage
template_smq(
dataname,
parentname,
arm_var,
llt = "AEDECOD",
add_total = TRUE,
total_label = default_total_label(),
sort_criteria = c("freq_desc", "alpha"),
drop_arm_levels = TRUE,
na_level = default_na_str(),
smq_varlabel = "Standardized MedDRA Query",
baskets = c("SMQ01NAM", "SMQ02NAM", "CQ01NAM"),
id_var = "USUBJID",
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
dataname |
( |
parentname |
( |
arm_var |
( |
llt |
( |
add_total |
( |
total_label |
( |
sort_criteria |
( |
drop_arm_levels |
( |
na_level |
( |
smq_varlabel |
( |
baskets |
( |
id_var |
( |
basic_table_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Summary of Variables
Description
Creates a valid expression to generate a table to summarize variables.
Usage
template_summary(
dataname,
parentname,
arm_var,
sum_vars,
show_labels = lifecycle::deprecated(),
add_total = TRUE,
total_label = default_total_label(),
var_labels = character(),
arm_var_labels = NULL,
na.rm = FALSE,
na_level = default_na_str(),
numeric_stats = c("n", "mean_sd", "mean_ci", "median", "median_ci", "quantiles",
"range", "geom_mean"),
denominator = c("N", "n", "omit"),
drop_arm_levels = TRUE,
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
dataname |
( |
parentname |
( |
arm_var |
( |
sum_vars |
( |
show_labels |
|
add_total |
( |
total_label |
( |
var_labels |
(named |
arm_var_labels |
( |
na.rm |
( |
na_level |
( |
numeric_stats |
( |
denominator |
( |
drop_arm_levels |
( |
basic_table_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Summarize Variables by Row Groups Module
Description
Creates a valid expression to generate a table to summarize variables by row groups.
Usage
template_summary_by(
parentname,
dataname,
arm_var,
id_var,
sum_vars,
by_vars,
var_labels = character(),
add_total = TRUE,
total_label = default_total_label(),
parallel_vars = FALSE,
row_groups = FALSE,
na.rm = FALSE,
na_level = default_na_str(),
numeric_stats = c("n", "mean_sd", "mean_ci", "median", "median_ci", "quantiles",
"range"),
denominator = c("N", "n", "omit"),
drop_arm_levels = TRUE,
drop_zero_levels = TRUE,
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
parentname |
( |
dataname |
( |
arm_var |
( |
id_var |
( |
sum_vars |
( |
by_vars |
( |
var_labels |
(named |
add_total |
( |
total_label |
( |
parallel_vars |
( |
row_groups |
( |
na.rm |
( |
na_level |
( |
numeric_stats |
( |
denominator |
( |
drop_arm_levels |
( |
drop_zero_levels |
( |
basic_table_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Patient Profile Therapy Table and Plot
Description
Creates a valid expression to generate a patient profile therapy table and ggplot2::ggplot()
plot using ADaM
datasets.
Usage
template_therapy(
dataname = "ANL",
atirel = "ATIREL",
cmdecod = "CMDECOD",
cmindc = "CMINDC",
cmdose = "CMDOSE",
cmtrt = "CMTRT",
cmdosu = "CMDOSU",
cmroute = "CMROUTE",
cmdosfrq = "CMDOSFRQ",
cmstdy = "CMSTDY",
cmendy = "CMENDY",
patient_id,
font_size = 12L,
ggplot2_args = teal.widgets::ggplot2_args()
)
Arguments
dataname |
( |
atirel |
( |
cmdecod |
( |
cmindc |
( |
cmdose |
( |
cmtrt |
( |
cmdosu |
( |
cmroute |
( |
cmdosfrq |
( |
cmstdy |
( |
cmendy |
( |
patient_id |
( |
font_size |
( |
ggplot2_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Time-To-Event
Description
Creates a valid expression to generate a time-to-event analysis.
Usage
template_tte(
dataname = "ANL",
parentname = "ADSL",
arm_var = "ARM",
paramcd,
ref_arm = NULL,
comp_arm = NULL,
compare_arm = FALSE,
combine_comp_arms = FALSE,
aval_var = "AVAL",
cnsr_var = "CNSR",
strata_var = NULL,
time_points = NULL,
time_unit_var = "AVALU",
event_desc_var = "EVNTDESC",
control = control_tte(),
add_total = FALSE,
total_label = default_total_label(),
na_level = default_na_str(),
basic_table_args = teal.widgets::basic_table_args()
)
Arguments
dataname |
( |
parentname |
( |
arm_var |
( |
paramcd |
( |
ref_arm |
( |
comp_arm |
( |
compare_arm |
( |
combine_comp_arms |
( |
aval_var |
( |
cnsr_var |
( |
strata_var |
( |
time_points |
( |
time_unit_var |
( |
event_desc_var |
( |
control |
( |
add_total |
( |
total_label |
( |
na_level |
( |
basic_table_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
Template: Patient Profile Vitals Plot
Description
Creates a valid expression to generate a patient profile vitals ggplot2::ggplot()
plot using ADaM datasets.
Usage
template_vitals(
dataname = "ANL",
paramcd = "PARAMCD",
paramcd_levels = c("SYSBP", "DIABP", "PUL", "RESP", "OXYSAT", "WGHT", "TEMP"),
xaxis = "ADY",
aval = lifecycle::deprecated(),
aval_var = "AVAL",
patient_id,
font_size = 12L,
ggplot2_args = teal.widgets::ggplot2_args()
)
Arguments
dataname |
( |
paramcd |
( |
paramcd_levels |
( |
xaxis |
( |
aval |
|
aval_var |
( |
patient_id |
( |
font_size |
( |
ggplot2_args |
( |
Value
a list
of expressions to generate a table or plot object.
See Also
teal Module: Generalized Estimating Equations (GEE) analysis
Description
This module produces an analysis table using Generalized Estimating Equations (GEE).
Usage
tm_a_gee(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
aval_var,
id_var,
arm_var,
visit_var,
cov_var,
arm_ref_comp = NULL,
paramcd,
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()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
aval_var |
( |
id_var |
( |
arm_var |
( |
visit_var |
( |
cov_var |
( |
arm_ref_comp |
( |
paramcd |
( |
conf_level |
( |
pre_output |
( |
post_output |
( |
basic_table_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(ElementaryTable
- output ofrtables::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_a_gee( ..., # arguments for module decorators = list( table = teal_transform_module(...) # applied to the `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.
Examples in Shinylive
- example-1
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
ADQS <- tmc_ex_adqs %>%
filter(ABLFL != "Y" & ABLFL2 != "Y") %>%
mutate(
AVISIT = as.factor(AVISIT),
AVISITN = rank(AVISITN) %>%
as.factor() %>%
as.numeric() %>%
as.factor(),
AVALBIN = AVAL < 50 # Just as an example to get a binary endpoint.
) %>%
droplevels()
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
app <- init(
data = data,
modules = modules(
tm_a_gee(
label = "GEE",
dataname = "ADQS",
aval_var = choices_selected("AVALBIN", fixed = TRUE),
id_var = choices_selected(c("USUBJID", "SUBJID"), "USUBJID"),
arm_var = choices_selected(c("ARM", "ARMCD"), "ARM"),
visit_var = choices_selected(c("AVISIT", "AVISITN"), "AVISIT"),
paramcd = choices_selected(
choices = value_choices(data[["ADQS"]], "PARAMCD", "PARAM"),
selected = "FKSI-FWB"
),
cov_var = choices_selected(c("BASE", "AGE", "SEX", "BASE:AVISIT"), NULL)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Mixed Model Repeated Measurements (MMRM) Analysis
Description
This module produces analysis tables and plots for Mixed Model Repeated Measurements.
Usage
tm_a_mmrm(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
aval_var,
id_var,
arm_var,
visit_var,
cov_var,
arm_ref_comp = NULL,
paramcd,
method = teal.transform::choices_selected(c("Satterthwaite", "Kenward-Roger",
"Kenward-Roger-Linear"), "Satterthwaite", keep_order = TRUE),
conf_level = teal.transform::choices_selected(c(0.95, 0.9, 0.8), 0.95, keep_order =
TRUE),
plot_height = c(700L, 200L, 2000L),
plot_width = NULL,
total_label = default_total_label(),
pre_output = NULL,
post_output = NULL,
basic_table_args = teal.widgets::basic_table_args(),
ggplot2_args = teal.widgets::ggplot2_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
aval_var |
( |
id_var |
( |
arm_var |
( |
visit_var |
( |
cov_var |
( |
arm_ref_comp |
( |
paramcd |
( |
method |
( |
conf_level |
( |
plot_height |
( |
plot_width |
( |
total_label |
( |
pre_output |
( |
post_output |
( |
basic_table_args |
( |
ggplot2_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
lsmeans_plot
(ggplot
) -
diagnostic_plot
(ggplot
) -
lsmeans_table
(TableTree
- output fromrtables::build_table
) -
covariance_table
(ElementaryTable
- output fromrtables::build_table
) -
fixed_effects_table
(ElementaryTable
- output fromrtables::build_table
) -
diagnostic_table
(ElementaryTable
- output fromrtables::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_a_mrmm( ..., # arguments for module decorators = list( lsmeans_plot = teal_transform_module(...), # applied only to `lsmeans_plot` output diagnostic_plot = teal_transform_module(...), # applied only to `diagnostic_plot` output lsmeans_table = teal_transform_module(...), # applied only to `lsmeans_table` output covariance_table = teal_transform_module(...), # applied only to `covariance_table` output fixed_effects_table = teal_transform_module(...), # applied only to `fixed_effects_table` output diagnostic_table = teal_transform_module(...) # applied only to `diagnostic_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.
Examples in Shinylive
- example-1
Note
The ordering of the input data sets can lead to slightly different numerical results or
different convergence behavior. This is a known observation with the used package
lme4
. However, once convergence is achieved, the results are reliable up to
numerical precision.
See Also
The TLG Catalog where additional example apps implementing this module can be found.
Examples
library(dplyr)
arm_ref_comp <- list(
ARMCD = list(
ref = "ARM B",
comp = c("ARM A", "ARM C")
)
)
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADQS <- tmc_ex_adqs %>%
filter(ABLFL != "Y" & ABLFL2 != "Y") %>%
filter(AVISIT %in% c("WEEK 1 DAY 8", "WEEK 2 DAY 15", "WEEK 3 DAY 22")) %>%
mutate(
AVISIT = as.factor(AVISIT),
AVISITN = rank(AVISITN) %>%
as.factor() %>%
as.numeric() %>%
as.factor() #' making consecutive numeric factor
)
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
app <- init(
data = data,
modules = modules(
tm_a_mmrm(
label = "MMRM",
dataname = "ADQS",
aval_var = choices_selected(c("AVAL", "CHG"), "AVAL"),
id_var = choices_selected(c("USUBJID", "SUBJID"), "USUBJID"),
arm_var = choices_selected(c("ARM", "ARMCD"), "ARM"),
visit_var = choices_selected(c("AVISIT", "AVISITN"), "AVISIT"),
arm_ref_comp = arm_ref_comp,
paramcd = choices_selected(
choices = value_choices(data[["ADQS"]], "PARAMCD", "PARAM"),
selected = "FKSI-FWB"
),
cov_var = choices_selected(c("BASE", "AGE", "SEX", "BASE:AVISIT"), NULL)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Simple Bar Chart and Table of Counts per Category
Description
This module produces a ggplot2::ggplot()
type bar chart and summary table of counts per category.
Usage
tm_g_barchart_simple(
x = NULL,
fill = NULL,
x_facet = NULL,
y_facet = NULL,
label = "Count Barchart",
plot_options = NULL,
plot_height = c(600L, 200L, 2000L),
plot_width = NULL,
pre_output = NULL,
post_output = NULL,
ggplot2_args = teal.widgets::ggplot2_args(),
transformators = list(),
decorators = list()
)
Arguments
x |
( |
fill |
( |
x_facet |
( |
y_facet |
( |
label |
( |
plot_options |
( |
plot_height |
( |
plot_width |
( |
pre_output |
( |
post_output |
( |
ggplot2_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Details
Categories can be defined up to four levels deep and are defined through the x
, fill
,
x_facet
, and y_facet
parameters. Any parameters set to NULL
(default) are ignored.
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
plot
(ggplot
)
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_g_barchart_simple( ..., # arguments for module decorators = list( plot = teal_transform_module(...) # applied only to `plot` 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.
Examples in Shinylive
- example-1
See Also
The TLG Catalog where additional example apps implementing this module can be found.
Examples
library(nestcolor)
library(dplyr)
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl %>%
mutate(ITTFL = factor("Y") %>%
with_label("Intent-To-Treat Population Flag"))
ADAE <- tmc_ex_adae %>%
filter(!((AETOXGR == 1) & (AESEV == "MILD") & (ARM == "A: Drug X")))
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADAE <- data[["ADAE"]]
app <- init(
data = data,
modules = modules(
tm_g_barchart_simple(
label = "ADAE Analysis",
x = data_extract_spec(
dataname = "ADSL",
select = select_spec(
choices = variable_choices(
ADSL,
c(
"ARM", "ACTARM", "SEX",
"RACE", "ITTFL", "SAFFL", "STRATA2"
)
),
selected = "ACTARM",
multiple = FALSE
)
),
fill = list(
data_extract_spec(
dataname = "ADSL",
select = select_spec(
choices = variable_choices(
ADSL,
c(
"ARM", "ACTARM", "SEX",
"RACE", "ITTFL", "SAFFL", "STRATA2"
)
),
selected = "SEX",
multiple = FALSE
)
),
data_extract_spec(
dataname = "ADAE",
select = select_spec(
choices = variable_choices(ADAE, c("AETOXGR", "AESEV", "AESER")),
selected = NULL,
multiple = FALSE
)
)
),
x_facet = list(
data_extract_spec(
dataname = "ADAE",
select = select_spec(
choices = variable_choices(ADAE, c("AETOXGR", "AESEV", "AESER")),
selected = "AETOXGR",
multiple = FALSE
)
),
data_extract_spec(
dataname = "ADSL",
select = select_spec(
choices = variable_choices(
ADSL,
c(
"ARM", "ACTARM", "SEX",
"RACE", "ITTFL", "SAFFL", "STRATA2"
)
),
selected = NULL,
multiple = FALSE
)
)
),
y_facet = list(
data_extract_spec(
dataname = "ADAE",
select = select_spec(
choices = variable_choices(ADAE, c("AETOXGR", "AESEV", "AESER")),
selected = "AESEV",
multiple = FALSE
)
),
data_extract_spec(
dataname = "ADSL",
select = select_spec(
choices = variable_choices(
ADSL,
c(
"ARM", "ACTARM", "SEX",
"RACE", "ITTFL", "SAFFL", "STRATA2"
)
),
selected = NULL,
multiple = FALSE
)
)
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Confidence Interval Plot
Description
This module produces a ggplot2::ggplot()
type confidence interval plot consistent with the TLG Catalog template
CIG01
available here.
Usage
tm_g_ci(
label,
x_var,
y_var,
color,
stat = c("mean", "median"),
conf_level = teal.transform::choices_selected(c(0.95, 0.9, 0.8), 0.95, keep_order =
TRUE),
plot_height = c(700L, 200L, 2000L),
plot_width = NULL,
pre_output = NULL,
post_output = NULL,
ggplot2_args = teal.widgets::ggplot2_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
x_var |
( |
y_var |
( |
color |
( |
stat |
( |
conf_level |
( |
plot_height |
( |
plot_width |
( |
pre_output |
( |
post_output |
( |
ggplot2_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
plot
(ggplot
)
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_g_ci( ..., # arguments for module decorators = list( plot = teal_transform_module(...) # applied only to `plot` 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.
Examples in Shinylive
- example-1
See Also
The TLG Catalog where additional example apps implementing this module can be found.
Examples
library(nestcolor)
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADLB <- tmc_ex_adlb
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADLB <- data[["ADLB"]]
app <- init(
data = data,
modules = modules(
tm_g_ci(
label = "Confidence Interval Plot",
x_var = data_extract_spec(
dataname = "ADSL",
select = select_spec(
choices = c("ARMCD", "BMRKR2"),
selected = c("ARMCD"),
multiple = FALSE,
fixed = FALSE
)
),
y_var = data_extract_spec(
dataname = "ADLB",
filter = list(
filter_spec(
vars = "PARAMCD",
choices = levels(ADLB$PARAMCD),
selected = levels(ADLB$PARAMCD)[1],
multiple = FALSE,
label = "Select lab:"
),
filter_spec(
vars = "AVISIT",
choices = levels(ADLB$AVISIT),
selected = levels(ADLB$AVISIT)[1],
multiple = FALSE,
label = "Select visit:"
)
),
select = select_spec(
label = "Analyzed Value",
choices = c("AVAL", "CHG"),
selected = "AVAL",
multiple = FALSE,
fixed = FALSE
)
),
color = data_extract_spec(
dataname = "ADSL",
select = select_spec(
label = "Color by variable",
choices = c("SEX", "STRATA1", "STRATA2"),
selected = c("STRATA1"),
multiple = FALSE,
fixed = FALSE
)
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Forest Response Plot
Description
This module produces a grid-style forest plot for response data with ADaM structure.
Usage
tm_g_forest_rsp(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var,
arm_ref_comp = NULL,
paramcd,
aval_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"AVALC"), "AVALC", fixed = TRUE),
subgroup_var,
strata_var,
stats = c("n_tot", "n", "n_rsp", "prop", "or", "ci"),
riskdiff = NULL,
fixed_symbol_size = TRUE,
conf_level = teal.transform::choices_selected(c(0.95, 0.9, 0.8), 0.95, keep_order =
TRUE),
default_responses = c("CR", "PR", "Y", "Complete Response (CR)",
"Partial Response (PR)"),
plot_height = c(500L, 200L, 2000L),
plot_width = c(1500L, 800L, 3000L),
rel_width_forest = c(25L, 0L, 100L),
font_size = c(15L, 1L, 30L),
pre_output = NULL,
post_output = NULL,
ggplot2_args = teal.widgets::ggplot2_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
arm_ref_comp |
( |
paramcd |
( |
aval_var |
( |
subgroup_var |
( |
strata_var |
( |
stats |
(
|
riskdiff |
( |
fixed_symbol_size |
( |
conf_level |
( |
default_responses |
( |
plot_height |
( |
plot_width |
( |
rel_width_forest |
( |
font_size |
( |
pre_output |
( |
post_output |
( |
ggplot2_args |
( For more details, see the vignette: |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
plot
(ggplot
)
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_g_forest_rsp( ..., # arguments for module decorators = list( plot = teal_transform_module(...) # applied only to `plot` 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.
Examples in Shinylive
- example-1
See Also
The TLG Catalog where additional example apps implementing this module can be found.
Examples
library(nestcolor)
library(dplyr)
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADRS <- tmc_ex_adrs %>%
mutate(AVALC = d_onco_rsp_label(AVALC) %>%
with_label("Character Result/Finding")) %>%
filter(PARAMCD != "OVRINV" | AVISIT == "FOLLOW UP")
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADRS <- data[["ADRS"]]
arm_ref_comp <- list(
ARM = list(
ref = "B: Placebo",
comp = c("A: Drug X", "C: Combination")
),
ARMCD = list(
ref = "ARM B",
comp = c("ARM A", "ARM C")
)
)
app <- init(
data = data,
modules = modules(
tm_g_forest_rsp(
label = "Forest Response",
dataname = "ADRS",
arm_var = choices_selected(
variable_choices(ADSL, c("ARM", "ARMCD")),
"ARMCD"
),
arm_ref_comp = arm_ref_comp,
paramcd = choices_selected(
value_choices(ADRS, "PARAMCD", "PARAM"),
"INVET"
),
subgroup_var = choices_selected(
variable_choices(ADSL, names(ADSL)),
c("BMRKR2", "SEX")
),
strata_var = choices_selected(
variable_choices(ADSL, c("STRATA1", "STRATA2")),
"STRATA2"
),
plot_height = c(600L, 200L, 2000L),
default_responses = list(
BESRSPI = list(
rsp = c("Stable Disease (SD)", "Not Evaluable (NE)"),
levels = c(
"Complete Response (CR)", "Partial Response (PR)", "Stable Disease (SD)",
"Progressive Disease (PD)", "Not Evaluable (NE)"
)
),
INVET = list(
rsp = c("Complete Response (CR)", "Partial Response (PR)"),
levels = c(
"Complete Response (CR)", "Not Evaluable (NE)", "Partial Response (PR)",
"Progressive Disease (PD)", "Stable Disease (SD)"
)
),
OVRINV = list(
rsp = c("Progressive Disease (PD)", "Stable Disease (SD)"),
levels = c("Progressive Disease (PD)", "Stable Disease (SD)", "Not Evaluable (NE)")
)
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Forest Survival Plot
Description
This module produces a grid-style forest plot for time-to-event data with ADaM structure.
Usage
tm_g_forest_tte(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var,
arm_ref_comp = NULL,
subgroup_var,
paramcd,
strata_var,
aval_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"AVAL"), "AVAL", fixed = TRUE),
cnsr_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"CNSR"), "CNSR", fixed = TRUE),
stats = c("n_tot_events", "n_events", "median", "hr", "ci"),
riskdiff = NULL,
conf_level = teal.transform::choices_selected(c(0.95, 0.9, 0.8), 0.95, keep_order =
TRUE),
time_unit_var =
teal.transform::choices_selected(teal.transform::variable_choices(dataname, "AVALU"),
"AVALU", fixed = TRUE),
fixed_symbol_size = TRUE,
plot_height = c(500L, 200L, 2000L),
plot_width = c(1500L, 800L, 3000L),
rel_width_forest = c(25L, 0L, 100L),
font_size = c(15L, 1L, 30L),
pre_output = NULL,
post_output = NULL,
ggplot2_args = teal.widgets::ggplot2_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
arm_ref_comp |
( |
subgroup_var |
( |
paramcd |
( |
strata_var |
( |
aval_var |
( |
cnsr_var |
( |
stats |
(
|
riskdiff |
( |
conf_level |
( |
time_unit_var |
( |
fixed_symbol_size |
( |
plot_height |
( |
plot_width |
( |
rel_width_forest |
( |
font_size |
( |
pre_output |
( |
post_output |
( |
ggplot2_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
plot
(ggplot
)
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_g_forest_tte( ..., # arguments for module decorators = list( plot = teal_transform_module(...) # applied only to `plot` 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.
Examples in Shinylive
- example-1
See Also
The TLG Catalog where additional example apps implementing this module can be found.
Examples
library(nestcolor)
library(dplyr)
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADTTE <- tmc_ex_adtte
ADSL$RACE <- droplevels(ADSL$RACE) %>% with_label("Race")
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADTTE <- data[["ADTTE"]]
arm_ref_comp <- list(
ARM = list(
ref = "B: Placebo",
comp = c("A: Drug X", "C: Combination")
),
ARMCD = list(
ref = "ARM B",
comp = c("ARM A", "ARM C")
)
)
app <- init(
data = data,
modules = modules(
tm_g_forest_tte(
label = "Forest Survival",
dataname = "ADTTE",
arm_var = choices_selected(
variable_choices(ADSL, c("ARM", "ARMCD")),
"ARMCD"
),
arm_ref_comp = arm_ref_comp,
paramcd = choices_selected(
value_choices(ADTTE, "PARAMCD", "PARAM"),
"OS"
),
subgroup_var = choices_selected(
variable_choices(ADSL, names(ADSL)),
c("BMRKR2", "SEX")
),
strata_var = choices_selected(
variable_choices(ADSL, c("STRATA1", "STRATA2")),
"STRATA2"
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Individual Patient Plots
Description
This module produces ggplot2::ggplot()
type individual patient plots that display trends in parameter
values over time for each patient, using data with ADaM structure.
Usage
tm_g_ipp(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var,
paramcd,
id_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"USUBJID"), "USUBJID", fixed = TRUE),
visit_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"AVISIT"), "AVISIT", fixed = TRUE),
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),
base_var = lifecycle::deprecated(),
baseline_var =
teal.transform::choices_selected(teal.transform::variable_choices(dataname, "BASE"),
"BASE", fixed = TRUE),
add_baseline_hline = FALSE,
separate_by_obs = FALSE,
suppress_legend = FALSE,
add_avalu = TRUE,
plot_height = c(1200L, 400L, 5000L),
plot_width = NULL,
pre_output = NULL,
post_output = NULL,
ggplot2_args = teal.widgets::ggplot2_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
paramcd |
( |
id_var |
( |
visit_var |
( |
aval_var |
( |
avalu_var |
( |
base_var |
|
baseline_var |
( |
add_baseline_hline |
( |
separate_by_obs |
( |
suppress_legend |
( |
add_avalu |
( |
plot_height |
( |
plot_width |
( |
pre_output |
( |
post_output |
( |
ggplot2_args |
( For more details, see the vignette: |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
plot
(ggplot
)
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_g_ipp( ..., # arguments for module decorators = list( plot = teal_transform_module(...) # applied only to `plot` 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.
Examples in Shinylive
- example-1
See Also
The TLG Catalog where additional example apps implementing this module can be found.
Examples
library(nestcolor)
library(dplyr)
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl %>%
slice(1:20) %>%
df_explicit_na()
ADLB <- tmc_ex_adlb %>%
filter(USUBJID %in% ADSL$USUBJID) %>%
df_explicit_na() %>%
filter(AVISIT != "SCREENING")
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADLB <- data[["ADLB"]]
app <- init(
data = data,
modules = modules(
tm_g_ipp(
label = "Individual Patient Plot",
dataname = "ADLB",
arm_var = choices_selected(
value_choices(ADLB, "ARMCD"),
"ARM A"
),
paramcd = choices_selected(
value_choices(ADLB, "PARAMCD"),
"ALT"
),
aval_var = choices_selected(
variable_choices(ADLB, c("AVAL", "CHG")),
"AVAL"
),
avalu_var = choices_selected(
variable_choices(ADLB, c("AVALU")),
"AVALU",
fixed = TRUE
),
id_var = choices_selected(
variable_choices(ADLB, c("USUBJID")),
"USUBJID",
fixed = TRUE
),
visit_var = choices_selected(
variable_choices(ADLB, c("AVISIT")),
"AVISIT"
),
baseline_var = choices_selected(
variable_choices(ADLB, c("BASE")),
"BASE",
fixed = TRUE
),
add_baseline_hline = FALSE,
separate_by_obs = FALSE
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Kaplan-Meier Plot
Description
This module produces a ggplot
-style Kaplan-Meier plot for data with ADaM structure.
Usage
tm_g_km(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var,
arm_ref_comp = NULL,
paramcd,
strata_var,
facet_var,
time_unit_var =
teal.transform::choices_selected(teal.transform::variable_choices(dataname, "AVALU"),
"AVALU", fixed = TRUE),
aval_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"AVAL"), "AVAL", fixed = TRUE),
cnsr_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"CNSR"), "CNSR", fixed = TRUE),
conf_level = teal.transform::choices_selected(c(0.95, 0.9, 0.8), 0.95, keep_order =
TRUE),
font_size = c(11L, 1L, 30),
control_annot_surv_med = control_surv_med_annot(),
control_annot_coxph = control_coxph_annot(x = 0.27, y = 0.35, w = 0.3),
legend_pos = c(0.9, 0.5),
rel_height_plot = c(80L, 0L, 100L),
plot_height = c(800L, 400L, 5000L),
plot_width = NULL,
pre_output = NULL,
post_output = NULL,
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
arm_ref_comp |
( |
paramcd |
( |
strata_var |
( |
facet_var |
( |
time_unit_var |
( |
aval_var |
( |
cnsr_var |
( |
conf_level |
( |
font_size |
( |
control_annot_surv_med |
( |
control_annot_coxph |
( |
legend_pos |
( |
rel_height_plot |
( |
plot_height |
( |
plot_width |
( |
pre_output |
( |
post_output |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
plot
(ggplot
)
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_g_km( ..., # arguments for module decorators = list( plot = teal_transform_module(...) # applied only to `plot` 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.
Examples in Shinylive
- example-1
See Also
The TLG Catalog where additional example apps implementing this module can be found.
Examples
library(nestcolor)
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADTTE <- tmc_ex_adtte
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADTTE <- data[["ADTTE"]]
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_g_km(
label = "Kaplan-Meier Plot",
dataname = "ADTTE",
arm_var = choices_selected(
variable_choices(ADSL, c("ARM", "ARMCD", "ACTARMCD")),
"ARM"
),
paramcd = choices_selected(
value_choices(ADTTE, "PARAMCD", "PARAM"),
"OS"
),
arm_ref_comp = arm_ref_comp,
strata_var = choices_selected(
variable_choices(ADSL, c("SEX", "BMRKR2")),
"SEX"
),
facet_var = choices_selected(
variable_choices(ADSL, c("SEX", "BMRKR2")),
NULL
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Line Plot
Description
This module produces a ggplot2::ggplot()
type line plot, with optional summary table, for standard ADaM data.
Usage
tm_g_lineplot(
label,
dataname,
parentname = NULL,
strata = lifecycle::deprecated(),
group_var =
teal.transform::choices_selected(teal.transform::variable_choices(parentname,
c("ARM", "ARMCD", "ACTARMCD")), "ARM"),
x = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"AVISIT"), "AVISIT", fixed = TRUE),
y = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
c("AVAL", "BASE", "CHG", "PCHG")), "AVAL"),
y_unit = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"AVALU"), "AVALU", fixed = TRUE),
paramcd = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"PARAMCD"), "PARAMCD", fixed = TRUE),
param = teal.transform::choices_selected(teal.transform::value_choices(dataname,
"PARAMCD", "PARAM"), "ALT"),
conf_level = teal.transform::choices_selected(c(0.95, 0.9, 0.8), 0.95, keep_order =
TRUE),
interval = "mean_ci",
mid = "mean",
whiskers = c("mean_ci_lwr", "mean_ci_upr"),
table = c("n", "mean_sd", "median", "range"),
mid_type = "pl",
mid_point_size = c(2, 1, 5),
table_font_size = c(4, 2, 6),
plot_height = c(1000L, 200L, 4000L),
plot_width = NULL,
pre_output = NULL,
post_output = NULL,
ggplot2_args = teal.widgets::ggplot2_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
strata |
|
group_var |
( |
x |
( |
y |
( |
y_unit |
( |
paramcd |
( |
param |
( |
conf_level |
( |
interval |
( |
mid |
( |
whiskers |
( |
table |
( |
mid_type |
( |
mid_point_size |
( |
table_font_size |
( |
plot_height |
( |
plot_width |
( |
pre_output |
( |
post_output |
( |
ggplot2_args |
( For more details, see the vignette: |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
plot
(ggplot
)
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_g_lineplot( ..., # arguments for module decorators = list( plot = teal_transform_module(...) # applied only to `plot` 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.
Examples in Shinylive
- example-1
See Also
The TLG Catalog where additional example apps implementing this module can be found.
Examples
library(nestcolor)
library(dplyr)
library(forcats)
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADLB <- tmc_ex_adlb %>%
mutate(AVISIT == fct_reorder(AVISIT, AVISITN, min))
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADLB <- data[["ADLB"]]
app <- init(
data = data,
modules = modules(
tm_g_lineplot(
label = "Line Plot",
dataname = "ADLB",
group_var = choices_selected(
variable_choices(ADSL, c("ARM", "ARMCD", "ACTARMCD")),
"ARM"
),
y = choices_selected(
variable_choices(ADLB, c("AVAL", "BASE", "CHG", "PCHG")),
"AVAL"
),
param = choices_selected(
value_choices(ADLB, "PARAMCD", "PARAM"),
"ALT"
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Patient Profile Adverse Events Table and Plot
Description
This module produces an adverse events table and ggplot2::ggplot()
type plot using ADaM datasets.
Usage
tm_g_pp_adverse_events(
label,
dataname = "ADAE",
parentname = "ADSL",
patient_col = "USUBJID",
aeterm = NULL,
tox_grade = NULL,
causality = NULL,
outcome = NULL,
action = NULL,
time = NULL,
decod = NULL,
font_size = c(12L, 12L, 25L),
plot_height = c(700L, 200L, 2000L),
plot_width = NULL,
pre_output = NULL,
post_output = NULL,
ggplot2_args = teal.widgets::ggplot2_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
patient_col |
( |
aeterm |
( |
tox_grade |
( |
causality |
( |
outcome |
( |
action |
( |
time |
( |
decod |
( |
font_size |
( |
plot_height |
( |
plot_width |
( |
pre_output |
( |
post_output |
( |
ggplot2_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators::
-
plot
(ggplot
) -
table
(datatables
- output ofDT::datatable()
)
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_g_pp_adverse_events( ..., # arguments for module decorators = list( plot = teal_transform_module(...), # applied only to `plot` output 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.
Examples in Shinylive
- example-1
Examples
library(nestcolor)
library(dplyr)
data <- teal_data()
data <- within(data, {
ADAE <- tmc_ex_adae
ADSL <- tmc_ex_adsl %>%
filter(USUBJID %in% ADAE$USUBJID)
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADAE <- data[["ADAE"]]
app <- init(
data = data,
modules = modules(
tm_g_pp_adverse_events(
label = "Adverse Events",
dataname = "ADAE",
parentname = "ADSL",
patient_col = "USUBJID",
plot_height = c(600L, 200L, 2000L),
aeterm = choices_selected(
choices = variable_choices(ADAE, "AETERM"),
selected = "AETERM"
),
tox_grade = choices_selected(
choices = variable_choices(ADAE, "AETOXGR"),
selected = "AETOXGR"
),
causality = choices_selected(
choices = variable_choices(ADAE, "AEREL"),
selected = "AEREL"
),
outcome = choices_selected(
choices = variable_choices(ADAE, "AEOUT"),
selected = "AEOUT"
),
action = choices_selected(
choices = variable_choices(ADAE, "AEACN"),
selected = "AEACN"
),
time = choices_selected(
choices = variable_choices(ADAE, "ASTDY"),
selected = "ASTDY"
),
decod = NULL
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Patient Profile Timeline Plot
Description
This module produces a patient profile timeline ggplot2::ggplot()
type plot using ADaM datasets.
Usage
tm_g_pp_patient_timeline(
label,
dataname_adcm = "ADCM",
dataname_adae = "ADAE",
parentname = "ADSL",
patient_col = "USUBJID",
aeterm = NULL,
cmdecod = NULL,
aetime_start = NULL,
aetime_end = NULL,
dstime_start = NULL,
dstime_end = NULL,
aerelday_start = NULL,
aerelday_end = NULL,
dsrelday_start = NULL,
dsrelday_end = NULL,
font_size = c(12L, 12L, 25L),
plot_height = c(700L, 200L, 2000L),
plot_width = NULL,
pre_output = NULL,
post_output = NULL,
ggplot2_args = teal.widgets::ggplot2_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname_adcm |
( |
dataname_adae |
( |
parentname |
( |
patient_col |
( |
aeterm |
( |
cmdecod |
( |
aetime_start |
( |
aetime_end |
( |
dstime_start |
( |
dstime_end |
( |
aerelday_start |
( |
aerelday_end |
( |
dsrelday_start |
( |
dsrelday_end |
( |
font_size |
( |
plot_height |
( |
plot_width |
( |
pre_output |
( |
post_output |
( |
ggplot2_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
plot
(ggplot
)
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_g_pp_patient_timeline( ..., # arguments for module decorators = list( plot = teal_transform_module(...) # applied only to `plot` 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.
Examples in Shinylive
- example-1
Examples
library(nestcolor)
library(dplyr)
data <- teal_data()
data <- within(data, {
ADAE <- tmc_ex_adae
ADSL <- tmc_ex_adsl %>%
filter(USUBJID %in% ADAE$USUBJID)
ADCM <- tmc_ex_adcm %>%
mutate(
CMSTDY = case_when(
CMCAT == "medcl B" ~ 20,
CMCAT == "medcl C" ~ 150,
TRUE ~ 1
) %>% with_label("Study Day of Start of Medication"),
CMENDY = case_when(
CMCAT == "medcl B" ~ 700,
CMCAT == "medcl C" ~ 1000,
TRUE ~ 500
) %>% with_label("Study Day of End of Medication"),
CMASTDTM = ASTDTM,
CMAENDTM = AENDTM
)
})
join_keys(data) <- default_cdisc_join_keys[c("ADSL", "ADAE", "ADCM")]
adcm_keys <- c("STUDYID", "USUBJID", "ASTDTM", "CMSEQ", "ATC1", "ATC2", "ATC3", "ATC4")
join_keys(data)["ADCM", "ADCM"] <- adcm_keys
join_keys(data)["ADAE", "ADCM"] <- c("STUDYID", "USUBJID")
app <- init(
data = data,
modules = modules(
tm_g_pp_patient_timeline(
label = "Patient Timeline",
dataname_adae = "ADAE",
dataname_adcm = "ADCM",
parentname = "ADSL",
patient_col = "USUBJID",
plot_height = c(600L, 200L, 2000L),
cmdecod = choices_selected(
choices = variable_choices(data[["ADCM"]], "CMDECOD"),
selected = "CMDECOD",
),
aeterm = choices_selected(
choices = variable_choices(data[["ADAE"]], "AETERM"),
selected = c("AETERM")
),
aetime_start = choices_selected(
choices = variable_choices(data[["ADAE"]], "ASTDTM"),
selected = c("ASTDTM")
),
aetime_end = choices_selected(
choices = variable_choices(data[["ADAE"]], "AENDTM"),
selected = c("AENDTM")
),
dstime_start = choices_selected(
choices = variable_choices(data[["ADCM"]], "CMASTDTM"),
selected = c("CMASTDTM")
),
dstime_end = choices_selected(
choices = variable_choices(data[["ADCM"]], "CMAENDTM"),
selected = c("CMAENDTM")
),
aerelday_start = choices_selected(
choices = variable_choices(data[["ADAE"]], "ASTDY"),
selected = c("ASTDY")
),
aerelday_end = choices_selected(
choices = variable_choices(data[["ADAE"]], "AENDY"),
selected = c("AENDY")
),
dsrelday_start = choices_selected(
choices = variable_choices(data[["ADCM"]], "ASTDY"),
selected = c("ASTDY")
),
dsrelday_end = choices_selected(
choices = variable_choices(data[["ADCM"]], "AENDY"),
selected = c("AENDY")
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Patient Profile Therapy Table and Plot
Description
This module produces a patient profile therapy table and ggplot2::ggplot()
type plot using ADaM datasets.
Usage
tm_g_pp_therapy(
label,
dataname = "ADCM",
parentname = "ADSL",
patient_col = "USUBJID",
atirel = NULL,
cmdecod = NULL,
cmindc = NULL,
cmdose = NULL,
cmtrt = NULL,
cmdosu = NULL,
cmroute = NULL,
cmdosfrq = NULL,
cmstdy = NULL,
cmendy = NULL,
font_size = c(12L, 12L, 25L),
plot_height = c(700L, 200L, 2000L),
plot_width = NULL,
pre_output = NULL,
post_output = NULL,
ggplot2_args = teal.widgets::ggplot2_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
patient_col |
( |
atirel |
( |
cmdecod |
( |
cmindc |
( |
cmdose |
( |
cmtrt |
( |
cmdosu |
( |
cmroute |
( |
cmdosfrq |
( |
cmstdy |
( |
cmendy |
( |
font_size |
( |
plot_height |
( |
plot_width |
( |
pre_output |
( |
post_output |
( |
ggplot2_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators::
-
plot
(ggplot
) -
table
(datatables
- output ofDT::datatable()
)
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_g_pp_therapy( ..., # arguments for module decorators = list( plot = teal_transform_module(...), # applied only to `plot` output 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.
Examples in Shinylive
- example-1
Examples
library(nestcolor)
library(dplyr)
data <- teal_data()
data <- within(data, {
ADCM <- tmc_ex_adcm
ADSL <- tmc_ex_adsl %>% filter(USUBJID %in% ADCM$USUBJID)
ADCM$CMASTDTM <- ADCM$ASTDTM
ADCM$CMAENDTM <- ADCM$AENDTM
})
join_keys(data) <- default_cdisc_join_keys[c("ADSL", "ADCM")]
adcm_keys <- c("STUDYID", "USUBJID", "ASTDTM", "CMSEQ", "ATC1", "ATC2", "ATC3", "ATC4")
join_keys(data)["ADCM", "ADCM"] <- adcm_keys
ADSL <- data[["ADSL"]]
ADCM <- data[["ADCM"]]
app <- init(
data = data,
modules = modules(
tm_g_pp_therapy(
label = "Therapy",
dataname = "ADCM",
parentname = "ADSL",
patient_col = "USUBJID",
plot_height = c(600L, 200L, 2000L),
atirel = choices_selected(
choices = variable_choices(ADCM, "ATIREL"),
selected = c("ATIREL")
),
cmdecod = choices_selected(
choices = variable_choices(ADCM, "CMDECOD"),
selected = "CMDECOD"
),
cmindc = choices_selected(
choices = variable_choices(ADCM, "CMINDC"),
selected = "CMINDC"
),
cmdose = choices_selected(
choices = variable_choices(ADCM, "CMDOSE"),
selected = "CMDOSE"
),
cmtrt = choices_selected(
choices = variable_choices(ADCM, "CMTRT"),
selected = "CMTRT"
),
cmdosu = choices_selected(
choices = variable_choices(ADCM, "CMDOSU"),
selected = c("CMDOSU")
),
cmroute = choices_selected(
choices = variable_choices(ADCM, "CMROUTE"),
selected = "CMROUTE"
),
cmdosfrq = choices_selected(
choices = variable_choices(ADCM, "CMDOSFRQ"),
selected = "CMDOSFRQ"
),
cmstdy = choices_selected(
choices = variable_choices(ADCM, "ASTDY"),
selected = "ASTDY"
),
cmendy = choices_selected(
choices = variable_choices(ADCM, "AENDY"),
selected = "AENDY"
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Patient Profile Vitals Plot
Description
This module produces a patient profile vitals ggplot2::ggplot()
type plot using ADaM datasets.
Usage
tm_g_pp_vitals(
label,
dataname = "ADVS",
parentname = "ADSL",
patient_col = "USUBJID",
paramcd = NULL,
aval = lifecycle::deprecated(),
aval_var = NULL,
xaxis = NULL,
font_size = c(12L, 12L, 25L),
plot_height = c(700L, 200L, 2000L),
plot_width = NULL,
pre_output = NULL,
post_output = NULL,
ggplot2_args = teal.widgets::ggplot2_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
patient_col |
( |
paramcd |
( |
aval |
|
aval_var |
( |
xaxis |
( |
font_size |
( |
plot_height |
( |
plot_width |
( |
pre_output |
( |
post_output |
( |
ggplot2_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Details
This plot supports horizontal lines for the following 6 PARAMCD
levels when they are present in dataname
:
"SYSBP"
, "DIABP"
, "TEMP"
, "RESP"
, "OXYSAT"
.
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
plot
(ggplot
)
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_g_pp_vitals( ..., # arguments for module decorators = list( plot = teal_transform_module(...) # applied only to `plot` 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.
Examples in Shinylive
- example-1
Examples
library(nestcolor)
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADVS <- tmc_ex_advs
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADVS <- data[["ADVS"]]
app <- init(
data = data,
modules = modules(
tm_g_pp_vitals(
label = "Vitals",
dataname = "ADVS",
parentname = "ADSL",
patient_col = "USUBJID",
plot_height = c(600L, 200L, 2000L),
paramcd = choices_selected(
choices = variable_choices(ADVS, "PARAMCD"),
selected = "PARAMCD"
),
xaxis = choices_selected(
choices = variable_choices(ADVS, "ADY"),
selected = "ADY"
),
aval_var = choices_selected(
choices = variable_choices(ADVS, "AVAL"),
selected = "AVAL"
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Abnormality Summary Table
Description
This module produces a table to summarize abnormality.
Usage
tm_t_abnormality(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var,
by_vars,
grade,
abnormal = list(low = c("LOW", "LOW LOW"), high = c("HIGH", "HIGH HIGH")),
id_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
subset = "USUBJID"), selected = "USUBJID", fixed = TRUE),
baseline_var =
teal.transform::choices_selected(teal.transform::variable_choices(dataname, subset =
"BNRIND"), selected = "BNRIND", fixed = TRUE),
treatment_flag_var =
teal.transform::choices_selected(teal.transform::variable_choices(dataname, subset =
"ONTRTFL"), selected = "ONTRTFL", fixed = TRUE),
treatment_flag = teal.transform::choices_selected("Y"),
add_total = TRUE,
total_label = default_total_label(),
exclude_base_abn = FALSE,
drop_arm_levels = TRUE,
pre_output = NULL,
post_output = NULL,
na_level = default_na_str(),
basic_table_args = teal.widgets::basic_table_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
by_vars |
( |
grade |
( |
abnormal |
( |
id_var |
( |
baseline_var |
( |
treatment_flag_var |
( |
treatment_flag |
( |
add_total |
( |
total_label |
( |
exclude_base_abn |
( |
drop_arm_levels |
( |
pre_output |
( |
post_output |
( |
na_level |
( |
basic_table_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(TableTree
- output ofrtables::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_abnormality( ..., # 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.
Examples in Shinylive
- example-1
Note
Patients with the same abnormality at baseline as on the treatment visit can be
excluded in accordance with GDSR specifications by using exclude_base_abn
.
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
ADLB <- tmc_ex_adlb %>%
mutate(
ONTRTFL = case_when(
AVISIT %in% c("SCREENING", "BASELINE") ~ "",
TRUE ~ "Y"
) %>% with_label("On Treatment Record Flag")
)
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADLB <- data[["ADLB"]]
app <- init(
data = data,
modules = modules(
tm_t_abnormality(
label = "Abnormality Table",
dataname = "ADLB",
arm_var = choices_selected(
choices = variable_choices(ADSL, subset = c("ARM", "ARMCD")),
selected = "ARM"
),
add_total = FALSE,
by_vars = choices_selected(
choices = variable_choices(ADLB, subset = c("LBCAT", "PARAM", "AVISIT")),
selected = c("LBCAT", "PARAM"),
keep_order = TRUE
),
baseline_var = choices_selected(
variable_choices(ADLB, subset = "BNRIND"),
selected = "BNRIND", fixed = TRUE
),
grade = choices_selected(
choices = variable_choices(ADLB, subset = "ANRIND"),
selected = "ANRIND",
fixed = TRUE
),
abnormal = list(low = "LOW", high = "HIGH"),
exclude_base_abn = FALSE
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Laboratory test results with highest grade post-baseline
Description
This module produces a table to summarize laboratory test results with highest grade post-baseline
Usage
tm_t_abnormality_by_worst_grade(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var,
id_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
subset = "USUBJID"), selected = "USUBJID", fixed = TRUE),
paramcd,
atoxgr_var =
teal.transform::choices_selected(teal.transform::variable_choices(dataname, subset =
"ATOXGR"), selected = "ATOXGR", fixed = TRUE),
worst_high_flag_var =
teal.transform::choices_selected(teal.transform::variable_choices(dataname, subset =
"WGRHIFL"), selected = "WGRHIFL", fixed = TRUE),
worst_low_flag_var =
teal.transform::choices_selected(teal.transform::variable_choices(dataname, subset =
"WGRLOFL"), selected = "WGRLOFL", fixed = TRUE),
worst_flag_indicator = teal.transform::choices_selected("Y"),
add_total = TRUE,
total_label = default_total_label(),
drop_arm_levels = TRUE,
pre_output = NULL,
post_output = NULL,
basic_table_args = teal.widgets::basic_table_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
id_var |
( |
paramcd |
( |
atoxgr_var |
( |
worst_high_flag_var |
( |
worst_low_flag_var |
( |
worst_flag_indicator |
( |
add_total |
( |
total_label |
( |
drop_arm_levels |
( |
pre_output |
( |
post_output |
( |
basic_table_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(TableTree
- output ofrtables::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_abnormality_by_worst_grade( ..., # 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.
Examples in Shinylive
- example-1
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
ADLB <- tmc_ex_adlb %>%
filter(!AVISIT %in% c("SCREENING", "BASELINE"))
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADLB <- data[["ADLB"]]
app <- init(
data = data,
modules = modules(
tm_t_abnormality_by_worst_grade(
label = "Laboratory Test Results with Highest Grade Post-Baseline",
dataname = "ADLB",
arm_var = choices_selected(
choices = variable_choices(ADSL, subset = c("ARM", "ARMCD")),
selected = "ARM"
),
paramcd = choices_selected(
choices = value_choices(ADLB, "PARAMCD", "PARAM"),
selected = c("ALT", "CRP", "IGA")
),
add_total = FALSE
)
),
filter = teal_slices(
teal_slice("ADSL", "SAFFL", selected = "Y"),
teal_slice("ADLB", "ONTRTFL", selected = "Y")
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: ANCOVA Summary
Description
This module produces a table to summarize analysis of variance, consistent with the TLG Catalog
template for AOVT01
available here when multiple
endpoints are selected.
Usage
tm_t_ancova(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var,
arm_ref_comp = NULL,
aval_var,
cov_var,
include_interact = FALSE,
interact_var = NULL,
interact_y = FALSE,
avisit,
paramcd,
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()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
arm_ref_comp |
( |
aval_var |
( |
cov_var |
( |
include_interact |
( |
interact_var |
( |
interact_y |
( |
avisit |
( |
paramcd |
( |
conf_level |
( |
pre_output |
( |
post_output |
( |
basic_table_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Details
When a single endpoint is selected, both unadjusted and adjusted comparison are provided. This modules expects that the analysis data has the following variables:
-
AVISIT
: variable used to filter for analysis visits. -
PARAMCD
: variable used to filter for endpoints, after filtering forparamcd
andavisit
, one observation per patient is expected for the analysis to be meaningful.
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(TableTree
- output ofrtables::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_ancova( ..., # 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.
Examples in Shinylive
- example-1
See Also
The TLG Catalog where additional example apps implementing this module can be found.
Examples
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADQS <- tmc_ex_adqs
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADQS <- data[["ADQS"]]
arm_ref_comp <- list(
ARM = list(
ref = "B: Placebo",
comp = c("A: Drug X", "C: Combination")
),
ACTARMCD = list(
ref = "ARM B",
comp = c("ARM A", "ARM C")
)
)
app <- init(
data = data,
modules = modules(
tm_t_ancova(
label = "ANCOVA Table",
dataname = "ADQS",
avisit = choices_selected(
choices = value_choices(ADQS, "AVISIT"),
selected = "WEEK 1 DAY 8"
),
arm_var = choices_selected(
choices = variable_choices(ADSL, c("ARM", "ACTARMCD", "ARMCD")),
selected = "ARMCD"
),
arm_ref_comp = arm_ref_comp,
aval_var = choices_selected(
choices = variable_choices(ADQS, c("CHG", "AVAL")),
selected = "CHG"
),
cov_var = choices_selected(
choices = variable_choices(ADQS, c("BASE", "STRATA1", "SEX")),
selected = "STRATA1"
),
paramcd = choices_selected(
choices = value_choices(ADQS, "PARAMCD", "PARAM"),
selected = "FKSI-FWB"
),
interact_var = choices_selected(
choices = variable_choices(ADQS, c("BASE", "STRATA1", "SEX")),
selected = "STRATA1"
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Binary Outcome Table
Description
This module produces a binary outcome response summary table, with the option to match the template for
response table RSPT01
available in the TLG Catalog here.
Usage
tm_t_binary_outcome(
label,
dataname,
parentname = ifelse(test = inherits(arm_var, "data_extract_spec"), yes =
teal.transform::datanames_input(arm_var), no = "ADSL"),
arm_var,
arm_ref_comp = NULL,
paramcd,
strata_var,
aval_var = teal.transform::choices_selected(choices =
teal.transform::variable_choices(dataname, c("AVALC", "SEX")), selected = "AVALC",
fixed = FALSE),
conf_level = teal.transform::choices_selected(c(0.95, 0.9, 0.8), 0.95, keep_order =
TRUE),
default_responses = c("CR", "PR", "Y", "Complete Response (CR)",
"Partial Response (PR)", "M"),
rsp_table = FALSE,
control = list(global = list(method = ifelse(rsp_table, "clopper-pearson", "waldcc"),
conf_level = 0.95), unstrat = list(method_ci = ifelse(rsp_table, "wald", "waldcc"),
method_test = "schouten", odds = TRUE), strat = list(method_ci = "cmh", method_test =
"cmh")),
add_total = FALSE,
total_label = default_total_label(),
na_level = default_na_str(),
pre_output = NULL,
post_output = NULL,
basic_table_args = teal.widgets::basic_table_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
arm_ref_comp |
( |
paramcd |
( |
strata_var |
( |
aval_var |
( |
conf_level |
( |
default_responses |
( |
rsp_table |
( |
control |
(named
|
add_total |
( |
total_label |
( |
na_level |
( |
pre_output |
( |
post_output |
( |
basic_table_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Details
The display order of response categories inherits the factor level order of the source data. Use
base::factor()
and itslevels
argument to manipulate the source data in order to include/exclude or re-categorize response categories and arrange the display order. If response categories are"Missing"
,"Not Evaluable (NE)"
, or"Missing or unevaluable"
, 95% confidence interval will not be calculated.Reference arms are automatically combined if multiple arms selected as reference group.
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(TableTree
- output ofrtables::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_binary_outcome( ..., # 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.
Examples in Shinylive
- example-1
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
ADRS <- tmc_ex_adrs %>%
mutate(
AVALC = d_onco_rsp_label(AVALC) %>%
with_label("Character Result/Finding")
) %>%
filter(PARAMCD != "OVRINV" | AVISIT == "FOLLOW UP")
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADRS <- data[["ADRS"]]
arm_ref_comp <- list(
ARMCD = 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_binary_outcome(
label = "Responders",
dataname = "ADRS",
paramcd = choices_selected(
choices = value_choices(ADRS, "PARAMCD", "PARAM"),
selected = "BESRSPI"
),
arm_var = choices_selected(
choices = variable_choices(ADRS, c("ARM", "ARMCD", "ACTARMCD")),
selected = "ARM"
),
arm_ref_comp = arm_ref_comp,
strata_var = choices_selected(
choices = variable_choices(ADRS, c("SEX", "BMRKR2", "RACE")),
selected = "RACE"
),
default_responses = list(
BESRSPI = list(
rsp = c("Complete Response (CR)", "Partial Response (PR)"),
levels = c(
"Complete Response (CR)", "Partial Response (PR)",
"Stable Disease (SD)", "Progressive Disease (PD)"
)
),
INVET = list(
rsp = c("Stable Disease (SD)", "Not Evaluable (NE)"),
levels = c(
"Complete Response (CR)", "Not Evaluable (NE)", "Partial Response (PR)",
"Progressive Disease (PD)", "Stable Disease (SD)"
)
),
OVRINV = list(
rsp = c("Progressive Disease (PD)", "Stable Disease (SD)"),
levels = c("Progressive Disease (PD)", "Stable Disease (SD)", "Not Evaluable (NE)")
)
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Cox Regression Model
Description
This module fits Cox univariable or multi-variable models, consistent with the TLG Catalog
templates for Cox regression tables COXT01
and COXT02
, respectively. See the TLG Catalog entries
for COXT01
here
and COXT02
here.
Usage
tm_t_coxreg(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var,
arm_ref_comp = NULL,
paramcd,
cov_var,
strata_var,
aval_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"AVAL"), "AVAL", fixed = TRUE),
cnsr_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"CNSR"), "CNSR", fixed = TRUE),
multivariate = TRUE,
na_level = default_na_str(),
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()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
arm_ref_comp |
( |
paramcd |
( |
cov_var |
( |
strata_var |
( |
aval_var |
( |
cnsr_var |
( |
multivariate |
( |
na_level |
( |
conf_level |
( |
pre_output |
( |
post_output |
( |
basic_table_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Details
The Cox Proportional Hazards (PH) model is the most commonly used method to estimate the magnitude of the effect in survival analysis. It assumes proportional hazards: the ratio of the hazards between groups (e.g., two arms) is constant over time. This ratio is referred to as the "hazard ratio" (HR) and is one of the most commonly reported metrics to describe the effect size in survival analysis.
This modules expects that the analysis data has the following variables:
-
AVAL
: time to event -
CNSR
: 1 if record inAVAL
is censored, 0 otherwise -
PARAMCD
: variable used to filter for endpoint (e.g. OS). After filtering forPARAMCD
one observation per patient is expected
The arm variables and stratification/covariate variables are taken from the ADSL
data.
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(TableTree
as created fromrtables::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_coxreg( ..., # 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.
Examples in Shinylive
- example-1
- example-2
Note
The likelihood ratio test is not supported for models that include strata - the Wald test will be substituted in these cases.
Multi-variable is the default choice for backward compatibility.
See Also
The TLG Catalog where additional example apps implementing this module can be found.
Examples
## First example
## =============
## The example below is based on the usual approach involving creation of
## a random CDISC dataset and then running the application.
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")
)
)
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADTTE <- tmc_ex_adtte
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADTTE <- data[["ADTTE"]]
app <- init(
data = data,
modules = modules(
tm_t_coxreg(
label = "Cox Reg.",
dataname = "ADTTE",
arm_var = choices_selected(c("ARM", "ARMCD", "ACTARMCD"), "ARM"),
arm_ref_comp = arm_ref_comp,
paramcd = choices_selected(
value_choices(ADTTE, "PARAMCD", "PARAM"), "OS"
),
strata_var = choices_selected(
c("COUNTRY", "STRATA1", "STRATA2"), "STRATA1"
),
cov_var = choices_selected(
c("AGE", "BMRKR1", "BMRKR2", "REGION1"), "AGE"
),
multivariate = TRUE
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
## Second example
## ==============
## This time, a synthetic pair of ADTTE/ADSL data is fabricated for Cox regression
## where ties and pval_method matter.
library(dplyr)
data <- teal_data()
data <- within(data, {
ADTTE <- data.frame(
STUDYID = "LUNG",
AVAL = c(4, 3, 1, 1, 2, 2, 3, 1, 2),
CNSR = c(1, 1, 1, 0, 1, 1, 0, 0, 0),
ARMCD = factor(
c(0, 1, 1, 1, 1, 0, 0, 0, 0),
labels = c("ARM A", "ARM B")
),
SEX = factor(
c(0, 0, 0, 0, 1, 1, 1, 1, 1),
labels = c("F", "M")
),
INST = factor(c("A", "A", "B", "B", "A", "B", "A", "B", "A")),
stringsAsFactors = FALSE
)
ADTTE <- rbind(ADTTE, ADTTE, ADTTE, ADTTE)
ADTTE <- as_tibble(ADTTE)
set.seed(1)
ADTTE$INST <- sample(ADTTE$INST)
ADTTE$AGE <- sample(seq(5, 75, 5), size = nrow(ADTTE), replace = TRUE)
ADTTE$USUBJID <- paste("sub", 1:nrow(ADTTE), ADTTE$INST, sep = "-")
ADTTE$PARAM <- ADTTE$PARAMCD <- "OS"
ADSL <- subset(
ADTTE,
select = c("USUBJID", "STUDYID", "ARMCD", "SEX", "INST", "AGE")
)
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADTTE <- data[["ADTTE"]]
## `teal` application
## ----------------
## Note that the R code exported by `Show R Code` does not include the data
## pre-processing. You will need to create the dataset as above before
## running the exported R code.
arm_ref_comp <- list(ARMCD = list(ref = "ARM A", comp = c("ARM B")))
app <- init(
data = data,
modules = modules(
tm_t_coxreg(
label = "Cox Reg.",
dataname = "ADTTE",
arm_var = choices_selected(c("ARMCD"), "ARMCD"),
arm_ref_comp = arm_ref_comp,
paramcd = choices_selected(
value_choices(ADTTE, "PARAMCD", "PARAM"), "OS"
),
strata_var = choices_selected(c("INST"), NULL),
cov_var = choices_selected(c("SEX", "AGE"), "SEX"),
multivariate = TRUE
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Events by Term
Description
This module produces a table of events by term.
Usage
tm_t_events(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var,
hlt,
llt,
add_total = TRUE,
total_label = default_total_label(),
na_level = default_na_str(),
event_type = "event",
sort_criteria = c("freq_desc", "alpha"),
sort_freq_col = total_label,
prune_freq = 0,
prune_diff = 0,
drop_arm_levels = TRUE,
incl_overall_sum = TRUE,
pre_output = NULL,
post_output = NULL,
basic_table_args = teal.widgets::basic_table_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
hlt |
( |
llt |
( |
add_total |
( |
total_label |
( |
na_level |
( |
event_type |
( |
sort_criteria |
( |
sort_freq_col |
( |
prune_freq |
( |
prune_diff |
( |
drop_arm_levels |
( |
incl_overall_sum |
( |
pre_output |
( |
post_output |
( |
basic_table_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(TableTree
as created fromrtables::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( ..., # 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.
Examples in Shinylive
- example-1
See Also
The TLG Catalog where additional example apps implementing this module can be found.
Examples
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADAE <- tmc_ex_adae
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADAE <- data[["ADAE"]]
app <- init(
data = data,
modules = modules(
tm_t_events(
label = "Adverse Event Table",
dataname = "ADAE",
arm_var = choices_selected(c("ARM", "ARMCD"), "ARM"),
llt = choices_selected(
choices = variable_choices(ADAE, c("AETERM", "AEDECOD")),
selected = c("AEDECOD")
),
hlt = choices_selected(
choices = variable_choices(ADAE, c("AEBODSYS", "AESOC")),
selected = "AEBODSYS"
),
add_total = TRUE,
event_type = "adverse event"
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Events by Grade
Description
This module produces a table to summarize events by grade.
Usage
tm_t_events_by_grade(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var,
hlt,
llt,
grade,
grading_groups = list(`Any Grade (%)` = c("1", "2", "3", "4", "5"), `Grade 1-2 (%)` =
c("1", "2"), `Grade 3-4 (%)` = c("3", "4"), `Grade 5 (%)` = "5"),
col_by_grade = FALSE,
prune_freq = 0,
prune_diff = 0,
add_total = TRUE,
total_label = default_total_label(),
na_level = default_na_str(),
drop_arm_levels = TRUE,
pre_output = NULL,
post_output = NULL,
basic_table_args = teal.widgets::basic_table_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
hlt |
( |
llt |
( |
grade |
( |
grading_groups |
( |
col_by_grade |
( |
prune_freq |
( |
prune_diff |
( |
add_total |
( |
total_label |
( |
na_level |
( |
drop_arm_levels |
( |
pre_output |
( |
post_output |
( |
basic_table_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(TableTree
as created fromrtables::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_by_grade( ..., # 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.
Examples in Shinylive
- example-1
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
.lbls_adae <- col_labels(tmc_ex_adae)
ADAE <- tmc_ex_adae %>%
mutate_if(is.character, as.factor) #' be certain of having factors
col_labels(ADAE) <- .lbls_adae
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADAE <- data[["ADAE"]]
app <- init(
data = data,
modules = modules(
tm_t_events_by_grade(
label = "Adverse Events by Grade Table",
dataname = "ADAE",
arm_var = choices_selected(c("ARM", "ARMCD"), "ARM"),
llt = choices_selected(
choices = variable_choices(ADAE, c("AETERM", "AEDECOD")),
selected = c("AEDECOD")
),
hlt = choices_selected(
choices = variable_choices(ADAE, c("AEBODSYS", "AESOC")),
selected = "AEBODSYS"
),
grade = choices_selected(
choices = variable_choices(ADAE, c("AETOXGR", "AESEV")),
selected = "AETOXGR"
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Event Rates Adjusted for Patient-Years
Description
This module produces a table of event rates adjusted for patient-years.
Usage
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()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
events_var |
( |
paramcd |
( |
aval_var |
( |
avalu_var |
( |
add_total |
( |
total_label |
( |
na_level |
( |
conf_level |
( |
drop_arm_levels |
( |
pre_output |
( |
post_output |
( |
basic_table_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(ElementaryTable
as created fromrtables::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.
Examples in Shinylive
- example-1
- example-2
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
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)
}
teal Module: Adverse Events Summary
Description
This module produces an adverse events summary table.
Usage
tm_t_events_summary(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var,
flag_var_anl = NULL,
flag_var_aesi = NULL,
dthfl_var =
teal.transform::choices_selected(teal.transform::variable_choices(parentname,
"DTHFL"), "DTHFL", fixed = TRUE),
dcsreas_var =
teal.transform::choices_selected(teal.transform::variable_choices(parentname,
"DCSREAS"), "DCSREAS", fixed = TRUE),
llt = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"AEDECOD"), "AEDECOD", fixed = TRUE),
aeseq_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"AESEQ"), "AESEQ", fixed = TRUE),
add_total = TRUE,
total_label = default_total_label(),
na_level = default_na_str(),
count_dth = TRUE,
count_wd = TRUE,
count_subj = TRUE,
count_pt = TRUE,
count_events = TRUE,
pre_output = NULL,
post_output = NULL,
basic_table_args = teal.widgets::basic_table_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
flag_var_anl |
( |
flag_var_aesi |
( |
dthfl_var |
( |
dcsreas_var |
( |
llt |
( |
aeseq_var |
( |
add_total |
( |
total_label |
( |
na_level |
( |
count_dth |
( |
count_wd |
( |
count_subj |
( |
count_pt |
( |
count_events |
( |
pre_output |
( |
post_output |
( |
basic_table_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(TableTree
as created fromrtables::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_summary( ..., # 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.
Examples in Shinylive
- example-1
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 %>%
mutate(
DTHFL = case_when(
!is.na(DTHDT) ~ "Y",
TRUE ~ ""
) %>% with_label("Subject Death Flag")
)
ADAE <- tmc_ex_adae
.add_event_flags <- function(dat) {
dat <- dat %>%
mutate(
TMPFL_SER = AESER == "Y",
TMPFL_REL = AEREL == "Y",
TMPFL_GR5 = AETOXGR == "5",
TMP_SMQ01 = !is.na(SMQ01NAM),
TMP_SMQ02 = !is.na(SMQ02NAM),
TMP_CQ01 = !is.na(CQ01NAM)
)
column_labels <- list(
TMPFL_SER = "Serious AE",
TMPFL_REL = "Related AE",
TMPFL_GR5 = "Grade 5 AE",
TMP_SMQ01 = aesi_label(dat[["SMQ01NAM"]], dat[["SMQ01SC"]]),
TMP_SMQ02 = aesi_label("Y.9.9.9.9/Z.9.9.9.9 AESI"),
TMP_CQ01 = aesi_label(dat[["CQ01NAM"]])
)
col_labels(dat)[names(column_labels)] <- as.character(column_labels)
dat
}
#' Generating user-defined event flags.
ADAE <- ADAE %>% .add_event_flags()
.ae_anl_vars <- names(ADAE)[startsWith(names(ADAE), "TMPFL_")]
.aesi_vars <- names(ADAE)[startsWith(names(ADAE), "TMP_")]
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
app <- init(
data = data,
modules = modules(
tm_t_events_summary(
label = "Adverse Events Summary",
dataname = "ADAE",
arm_var = choices_selected(
choices = variable_choices("ADSL", c("ARM", "ARMCD")),
selected = "ARM"
),
flag_var_anl = choices_selected(
choices = variable_choices("ADAE", data[[".ae_anl_vars"]]),
selected = data[[".ae_anl_vars"]][1],
keep_order = TRUE,
fixed = FALSE
),
flag_var_aesi = choices_selected(
choices = variable_choices("ADAE", data[[".aesi_vars"]]),
selected = data[[".aesi_vars"]][1],
keep_order = TRUE,
fixed = FALSE
),
add_total = TRUE
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
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(),
transformators = list(),
decorators = list()
)
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 |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(ElementaryTable
as created fromrtables::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.
Examples in Shinylive
- example-1
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
})
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)
}
teal Module: Logistic Regression
Description
This module produces a multi-variable logistic regression table consistent with the TLG Catalog template
LGRT02
available here.
Usage
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()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
arm_ref_comp |
( |
paramcd |
( |
cov_var |
( |
avalc_var |
( |
conf_level |
( |
pre_output |
( |
post_output |
( |
basic_table_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(TableTree
- output ofrtables::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.
Examples in Shinylive
- example-1
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
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"
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Multiple Events by Term
Description
This module produces a table of multiple events by term.
Usage
tm_t_mult_events(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var,
seq_var,
hlt,
llt,
add_total = TRUE,
total_label = default_total_label(),
na_level = default_na_str(),
event_type = "event",
title_text = "Concomitant Medications",
drop_arm_levels = TRUE,
pre_output = NULL,
post_output = NULL,
basic_table_args = teal.widgets::basic_table_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
seq_var |
( |
hlt |
( |
llt |
( |
add_total |
( |
total_label |
( |
na_level |
( |
event_type |
( |
title_text |
( |
drop_arm_levels |
( |
pre_output |
( |
post_output |
( |
basic_table_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(TableTree
- output ofrtables::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_mult_events( ..., # 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.
Examples in Shinylive
- example-1
See Also
The TLG Catalog where additional example apps implementing this module can be found.
Examples
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADCM <- tmc_ex_adcm
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
adcm_keys <- c("STUDYID", "USUBJID", "ASTDTM", "CMSEQ", "ATC1", "ATC2", "ATC3", "ATC4")
join_keys(data)["ADCM", "ADCM"] <- adcm_keys
ADSL <- data[["ADSL"]]
ADCM <- data[["ADCM"]]
app <- init(
data = data,
modules = modules(
tm_t_mult_events(
label = "Concomitant Medications by Medication Class and Preferred Name",
dataname = "ADCM",
arm_var = choices_selected(c("ARM", "ARMCD"), "ARM"),
seq_var = choices_selected("CMSEQ", selected = "CMSEQ", fixed = TRUE),
hlt = choices_selected(
choices = variable_choices(ADCM, c("ATC1", "ATC2", "ATC3", "ATC4")),
selected = c("ATC1", "ATC2", "ATC3", "ATC4")
),
llt = choices_selected(
choices = variable_choices(ADCM, c("CMDECOD")),
selected = c("CMDECOD")
),
add_total = TRUE,
event_type = "treatment"
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Patient Profile Basic Info
Description
This module produces a patient profile basic info report using ADaM datasets.
Usage
tm_t_pp_basic_info(
label,
dataname = "ADSL",
patient_col = "USUBJID",
vars = NULL,
pre_output = NULL,
post_output = NULL,
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
patient_col |
( |
vars |
( |
pre_output |
( |
post_output |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(datatables
- output ofDT::datatable()
)
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_pp_basic_info( ..., # 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.
Examples in Shinylive
- example-1
Examples
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
app <- init(
data = data,
modules = modules(
tm_t_pp_basic_info(
label = "Basic Info",
dataname = "ADSL",
patient_col = "USUBJID",
vars = choices_selected(
choices = variable_choices(ADSL),
selected = c("ARM", "AGE", "SEX", "COUNTRY", "RACE", "EOSSTT")
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Patient Profile Laboratory Table
Description
This module produces a patient profile laboratory table using ADaM datasets.
Usage
tm_t_pp_laboratory(
label,
dataname = "ADLB",
parentname = "ADSL",
patient_col = "USUBJID",
timepoints = NULL,
aval = lifecycle::deprecated(),
aval_var = NULL,
avalu = lifecycle::deprecated(),
avalu_var = NULL,
param = NULL,
paramcd = NULL,
anrind = NULL,
pre_output = NULL,
post_output = NULL,
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
patient_col |
( |
timepoints |
( |
aval |
|
aval_var |
( |
avalu |
|
avalu_var |
( |
param |
( |
paramcd |
( |
anrind |
( |
pre_output |
( |
post_output |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(datatables
- output ofDT::datatable()
)
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_pp_laboratory( ..., # 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.
Examples in Shinylive
- example-1
Examples
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADLB <- tmc_ex_adlb
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADLB <- data[["ADLB"]]
app <- init(
data = data,
modules = modules(
tm_t_pp_laboratory(
label = "Vitals",
dataname = "ADLB",
patient_col = "USUBJID",
paramcd = choices_selected(
choices = variable_choices(ADLB, "PARAMCD"),
selected = "PARAMCD"
),
param = choices_selected(
choices = variable_choices(ADLB, "PARAM"),
selected = "PARAM"
),
timepoints = choices_selected(
choices = variable_choices(ADLB, "ADY"),
selected = "ADY"
),
anrind = choices_selected(
choices = variable_choices(ADLB, "ANRIND"),
selected = "ANRIND"
),
aval_var = choices_selected(
choices = variable_choices(ADLB, "AVAL"),
selected = "AVAL"
),
avalu_var = choices_selected(
choices = variable_choices(ADLB, "AVALU"),
selected = "AVALU"
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Patient Profile Medical History
Description
This module produces a patient profile medical history report using ADaM datasets.
Usage
tm_t_pp_medical_history(
label,
dataname = "ADMH",
parentname = "ADSL",
patient_col = "USUBJID",
mhterm = NULL,
mhbodsys = NULL,
mhdistat = NULL,
pre_output = NULL,
post_output = NULL,
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
patient_col |
( |
mhterm |
( |
mhbodsys |
( |
mhdistat |
( |
pre_output |
( |
post_output |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(TableTree
- output ofrtables::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_pp_medical_history( ..., # 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.
Examples in Shinylive
- example-1
Examples
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADMH <- tmc_ex_admh
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADMH <- data[["ADMH"]]
app <- init(
data = data,
modules = modules(
tm_t_pp_medical_history(
label = "Medical History",
dataname = "ADMH",
parentname = "ADSL",
patient_col = "USUBJID",
mhterm = choices_selected(
choices = variable_choices(ADMH, c("MHTERM")),
selected = "MHTERM"
),
mhbodsys = choices_selected(
choices = variable_choices(ADMH, "MHBODSYS"),
selected = "MHBODSYS"
),
mhdistat = choices_selected(
choices = variable_choices(ADMH, "MHDISTAT"),
selected = "MHDISTAT"
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Patient Profile Prior Medication
Description
This module produces a patient profile prior medication report using ADaM datasets.
Usage
tm_t_pp_prior_medication(
label,
dataname = "ADCM",
parentname = "ADSL",
patient_col = "USUBJID",
atirel = NULL,
cmdecod = NULL,
cmindc = NULL,
cmstdy = NULL,
pre_output = NULL,
post_output = NULL,
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
patient_col |
( |
atirel |
( |
cmdecod |
( |
cmindc |
( |
cmstdy |
( |
pre_output |
( |
post_output |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(datatables
- output ofDT::datatable()
)
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_pp_prior_medication( ..., # 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.
Examples in Shinylive
- example-1
Examples
library(dplyr)
data <- teal_data()
data <- within(data, {
ADCM <- tmc_ex_adcm
ADSL <- tmc_ex_adsl %>% filter(USUBJID %in% ADCM$USUBJID)
ADCM$CMASTDTM <- ADCM$ASTDTM
ADCM$CMAENDTM <- ADCM$AENDTM
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
adcm_keys <- c("STUDYID", "USUBJID", "ASTDTM", "CMSEQ", "ATC1", "ATC2", "ATC3", "ATC4")
join_keys(data)["ADCM", "ADCM"] <- adcm_keys
ADSL <- data[["ADSL"]]
ADCM <- data[["ADCM"]]
app <- init(
data = data,
modules = modules(
tm_t_pp_prior_medication(
label = "Prior Medication",
dataname = "ADCM",
parentname = "ADSL",
patient_col = "USUBJID",
atirel = choices_selected(
choices = variable_choices(ADCM, "ATIREL"),
selected = "ATIREL"
),
cmdecod = choices_selected(
choices = variable_choices(ADCM, "CMDECOD"),
selected = "CMDECOD"
),
cmindc = choices_selected(
choices = variable_choices(ADCM, "CMINDC"),
selected = "CMINDC"
),
cmstdy = choices_selected(
choices = variable_choices(ADCM, "ASTDY"),
selected = "ASTDY"
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Shift by Arm
Description
This module produces a summary table of analysis indicator levels by arm.
Usage
tm_t_shift_by_arm(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var,
paramcd,
visit_var,
aval_var,
base_var = lifecycle::deprecated(),
baseline_var,
treatment_flag_var =
teal.transform::choices_selected(teal.transform::variable_choices(dataname, subset =
"ONTRTFL"), selected = "ONTRTFL"),
treatment_flag = teal.transform::choices_selected("Y"),
useNA = c("ifany", "no"),
na_level = default_na_str(),
add_total = FALSE,
total_label = default_total_label(),
pre_output = NULL,
post_output = NULL,
basic_table_args = teal.widgets::basic_table_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
paramcd |
( |
visit_var |
( |
aval_var |
( |
base_var |
|
baseline_var |
( |
treatment_flag_var |
( |
treatment_flag |
( |
useNA |
( |
na_level |
( |
add_total |
( |
total_label |
( |
pre_output |
( |
post_output |
( |
basic_table_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(TableTree
- output ofrtables::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_shift_by_arm( ..., # 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.
Examples in Shinylive
- example-1
See Also
The TLG Catalog where additional example apps implementing this module can be found.
Examples
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADEG <- tmc_ex_adeg
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADEG <- data[["ADEG"]]
app <- init(
data = data,
modules = modules(
tm_t_shift_by_arm(
label = "Shift by Arm Table",
dataname = "ADEG",
arm_var = choices_selected(
variable_choices(ADSL, subset = c("ARM", "ARMCD")),
selected = "ARM"
),
paramcd = choices_selected(
value_choices(ADEG, "PARAMCD"),
selected = "HR"
),
visit_var = choices_selected(
value_choices(ADEG, "AVISIT"),
selected = "POST-BASELINE MINIMUM"
),
aval_var = choices_selected(
variable_choices(ADEG, subset = "ANRIND"),
selected = "ANRIND",
fixed = TRUE
),
baseline_var = choices_selected(
variable_choices(ADEG, subset = "BNRIND"),
selected = "BNRIND",
fixed = TRUE
),
useNA = "ifany"
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Shift by Arm by Worst Analysis Indicator Level
Description
This module produces a summary table of worst analysis indicator variable level per subject by arm.
Usage
tm_t_shift_by_arm_by_worst(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var,
paramcd,
aval_var,
base_var = lifecycle::deprecated(),
baseline_var,
worst_flag_var,
worst_flag,
treatment_flag_var = teal.transform::choices_selected(choices =
teal.transform::variable_choices(dataname, subset = "ONTRTFL"), selected = "ONTRTFL"),
treatment_flag = teal.transform::choices_selected("Y"),
useNA = c("ifany", "no"),
na_level = default_na_str(),
add_total = FALSE,
total_label = default_total_label(),
pre_output = NULL,
post_output = NULL,
basic_table_args = teal.widgets::basic_table_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
paramcd |
( |
aval_var |
( |
base_var |
|
baseline_var |
( |
worst_flag_var |
( |
worst_flag |
( |
treatment_flag_var |
( |
treatment_flag |
( |
useNA |
( |
na_level |
( |
add_total |
( |
total_label |
( |
pre_output |
( |
post_output |
( |
basic_table_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(TableTree
- output ofrtables::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_shift_by_arm_by_worst( ..., # 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.
Examples in Shinylive
- example-1
Examples
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADEG <- tmc_ex_adeg
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADEG <- data[["ADEG"]]
app <- init(
data = data,
modules = modules(
tm_t_shift_by_arm_by_worst(
label = "Shift by Arm Table",
dataname = "ADEG",
arm_var = choices_selected(
variable_choices(ADSL, subset = c("ARM", "ARMCD")),
selected = "ARM"
),
paramcd = choices_selected(
value_choices(ADEG, "PARAMCD"),
selected = "ECGINTP"
),
worst_flag_var = choices_selected(
variable_choices(ADEG, c("WORS02FL", "WORS01FL")),
selected = "WORS02FL"
),
worst_flag = choices_selected(
value_choices(ADEG, "WORS02FL"),
selected = "Y",
fixed = TRUE
),
aval_var = choices_selected(
variable_choices(ADEG, c("AVALC", "ANRIND")),
selected = "AVALC"
),
baseline_var = choices_selected(
variable_choices(ADEG, c("BASEC", "BNRIND")),
selected = "BASEC"
),
useNA = "ifany"
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Grade Summary Table
Description
This module produces a summary table of worst grades per subject by visit and parameter.
Usage
tm_t_shift_by_grade(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var,
visit_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
subset = "AVISIT"), selected = "AVISIT", fixed = TRUE),
paramcd,
worst_flag_var =
teal.transform::choices_selected(teal.transform::variable_choices(dataname, subset =
c("WGRLOVFL", "WGRLOFL", "WGRHIVFL", "WGRHIFL")), selected = "WGRLOVFL"),
worst_flag_indicator =
teal.transform::choices_selected(teal.transform::value_choices(dataname, "WGRLOVFL"),
selected = "Y", fixed = TRUE),
anl_toxgrade_var =
teal.transform::choices_selected(teal.transform::variable_choices(dataname, subset =
c("ATOXGR")), selected = c("ATOXGR"), fixed = TRUE),
base_toxgrade_var =
teal.transform::choices_selected(teal.transform::variable_choices(dataname, subset =
c("BTOXGR")), selected = c("BTOXGR"), fixed = TRUE),
id_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
subset = "USUBJID"), selected = "USUBJID", fixed = TRUE),
add_total = FALSE,
total_label = default_total_label(),
drop_arm_levels = TRUE,
pre_output = NULL,
post_output = NULL,
na_level = default_na_str(),
code_missing_baseline = FALSE,
basic_table_args = teal.widgets::basic_table_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
visit_var |
( |
paramcd |
( |
worst_flag_var |
( |
worst_flag_indicator |
( |
anl_toxgrade_var |
( |
base_toxgrade_var |
( |
id_var |
( |
add_total |
( |
total_label |
( |
drop_arm_levels |
( |
pre_output |
( |
post_output |
( |
na_level |
( |
code_missing_baseline |
( |
basic_table_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(TableTree
- output ofrtables::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_shift_by_grade( ..., # 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.
Examples in Shinylive
- example-1
See Also
The TLG Catalog where additional example apps implementing this module can be found.
Examples
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADLB <- tmc_ex_adlb
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADLB <- data[["ADLB"]]
app <- init(
data = data,
modules = modules(
tm_t_shift_by_grade(
label = "Grade Laboratory Abnormality Table",
dataname = "ADLB",
arm_var = choices_selected(
choices = variable_choices(ADSL, subset = c("ARM", "ARMCD")),
selected = "ARM"
),
paramcd = choices_selected(
choices = value_choices(ADLB, "PARAMCD", "PARAM"),
selected = "ALT"
),
worst_flag_var = choices_selected(
choices = variable_choices(ADLB, subset = c("WGRLOVFL", "WGRLOFL", "WGRHIVFL", "WGRHIFL")),
selected = c("WGRLOVFL")
),
worst_flag_indicator = choices_selected(
value_choices(ADLB, "WGRLOVFL"),
selected = "Y", fixed = TRUE
),
anl_toxgrade_var = choices_selected(
choices = variable_choices(ADLB, subset = c("ATOXGR")),
selected = c("ATOXGR"),
fixed = TRUE
),
base_toxgrade_var = choices_selected(
choices = variable_choices(ADLB, subset = c("BTOXGR")),
selected = c("BTOXGR"),
fixed = TRUE
),
add_total = FALSE
)
),
filter = teal_slices(teal_slice("ADSL", "SAFFL", selected = "Y"))
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Adverse Events Table by Standardized MedDRA Query
Description
This module produces an adverse events table by Standardized MedDRA Query.
Usage
tm_t_smq(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var,
id_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
subset = "USUBJID"), selected = "USUBJID", fixed = TRUE),
llt,
add_total = TRUE,
total_label = default_total_label(),
sort_criteria = c("freq_desc", "alpha"),
drop_arm_levels = TRUE,
na_level = default_na_str(),
smq_varlabel = "Standardized MedDRA Query",
baskets,
scopes,
pre_output = NULL,
post_output = NULL,
basic_table_args = teal.widgets::basic_table_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
id_var |
( |
llt |
( |
add_total |
( |
total_label |
( |
sort_criteria |
( |
drop_arm_levels |
( |
na_level |
( |
smq_varlabel |
( |
baskets |
( |
scopes |
( |
pre_output |
( |
post_output |
( |
basic_table_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(TableTree
- output ofrtables::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_smq( ..., # 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.
Examples in Shinylive
- example-1
See Also
The TLG Catalog where additional example apps implementing this module can be found.
Examples
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADAE <- tmc_ex_adae
.names_baskets <- grep("^(SMQ|CQ).*NAM$", names(ADAE), value = TRUE)
.names_scopes <- grep("^SMQ.*SC$", names(ADAE), value = TRUE)
.cs_baskets <- choices_selected(
choices = variable_choices(ADAE, subset = .names_baskets),
selected = .names_baskets
)
.cs_scopes <- choices_selected(
choices = variable_choices(ADAE, subset = .names_scopes),
selected = .names_scopes,
fixed = TRUE
)
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
app <- init(
data = data,
modules = modules(
tm_t_smq(
label = "Adverse Events by SMQ Table",
dataname = "ADAE",
arm_var = choices_selected(
choices = variable_choices(data[["ADSL"]], subset = c("ARM", "SEX")),
selected = "ARM"
),
add_total = FALSE,
baskets = data[[".cs_baskets"]],
scopes = data[[".cs_scopes"]],
llt = choices_selected(
choices = variable_choices(data[["ADAE"]], subset = c("AEDECOD")),
selected = "AEDECOD"
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Summary of Variables
Description
This module produces a table to summarize variables.
Usage
tm_t_summary(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var,
summarize_vars,
add_total = TRUE,
total_label = default_total_label(),
show_arm_var_labels = TRUE,
useNA = c("ifany", "no"),
na_level = default_na_str(),
numeric_stats = c("n", "mean_sd", "mean_ci", "median", "median_ci", "quantiles",
"range", "geom_mean"),
denominator = c("N", "n", "omit"),
drop_arm_levels = TRUE,
pre_output = NULL,
post_output = NULL,
basic_table_args = teal.widgets::basic_table_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
summarize_vars |
( |
add_total |
( |
total_label |
( |
show_arm_var_labels |
( |
useNA |
( |
na_level |
( |
numeric_stats |
( |
denominator |
( |
drop_arm_levels |
( |
pre_output |
( |
post_output |
( |
basic_table_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(TableTree
- output ofrtables::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_summary( ..., # 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.
Examples in Shinylive
- example-1
See Also
The TLG Catalog where additional example apps implementing this module can be found.
Examples
# Preparation of the test case - use `EOSDY` and `DCSREAS` variables to demonstrate missing data.
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADSL$EOSDY[1] <- NA_integer_
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
app <- init(
data = data,
modules = modules(
tm_t_summary(
label = "Demographic Table",
dataname = "ADSL",
arm_var = choices_selected(c("ARM", "ARMCD"), "ARM"),
add_total = TRUE,
summarize_vars = choices_selected(
c("SEX", "RACE", "BMRKR2", "EOSDY", "DCSREAS", "AGE"),
c("SEX", "RACE")
),
useNA = "ifany"
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Summarize Variables by Row Groups
Description
This module produces a table to summarize variables by row groups.
Usage
tm_t_summary_by(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var,
by_vars,
summarize_vars,
id_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
subset = "USUBJID"), selected = "USUBJID", fixed = TRUE),
paramcd = NULL,
add_total = TRUE,
total_label = default_total_label(),
parallel_vars = FALSE,
row_groups = FALSE,
useNA = c("ifany", "no"),
na_level = default_na_str(),
numeric_stats = c("n", "mean_sd", "median", "range"),
denominator = teal.transform::choices_selected(c("n", "N", "omit"), "omit", fixed =
TRUE),
drop_arm_levels = TRUE,
drop_zero_levels = TRUE,
pre_output = NULL,
post_output = NULL,
basic_table_args = teal.widgets::basic_table_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
by_vars |
( |
summarize_vars |
( |
id_var |
( |
paramcd |
( |
add_total |
( |
total_label |
( |
parallel_vars |
( |
row_groups |
( |
useNA |
( |
na_level |
( |
numeric_stats |
( |
denominator |
( |
drop_arm_levels |
( |
drop_zero_levels |
( |
pre_output |
( |
post_output |
( |
basic_table_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(TableTree
- output ofrtables::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_summary_by( ..., # 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.
Examples in Shinylive
- example-1
See Also
The TLG Catalog where additional example apps implementing this module can be found.
Examples
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADLB <- tmc_ex_adlb
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADLB <- data[["ADLB"]]
app <- init(
data = data,
modules = modules(
tm_t_summary_by(
label = "Summary by Row Groups Table",
dataname = "ADLB",
arm_var = choices_selected(
choices = variable_choices(ADSL, c("ARM", "ARMCD")),
selected = "ARM"
),
add_total = TRUE,
by_vars = choices_selected(
choices = variable_choices(ADLB, c("PARAM", "AVISIT")),
selected = c("AVISIT")
),
summarize_vars = choices_selected(
choices = variable_choices(ADLB, c("AVAL", "CHG")),
selected = c("AVAL")
),
useNA = "ifany",
paramcd = choices_selected(
choices = value_choices(ADLB, "PARAMCD", "PARAM"),
selected = "ALT"
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
teal Module: Time-To-Event Table
Description
This module produces a time-to-event analysis summary table, consistent with the TLG Catalog
template for TTET01
available here.
Usage
tm_t_tte(
label,
dataname,
parentname = ifelse(inherits(arm_var, "data_extract_spec"),
teal.transform::datanames_input(arm_var), "ADSL"),
arm_var,
arm_ref_comp = NULL,
paramcd,
strata_var,
aval_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"AVAL"), "AVAL", fixed = TRUE),
cnsr_var = teal.transform::choices_selected(teal.transform::variable_choices(dataname,
"CNSR"), "CNSR", fixed = TRUE),
conf_level_coxph = teal.transform::choices_selected(c(0.95, 0.9, 0.8), 0.95, keep_order
= TRUE),
conf_level_survfit = teal.transform::choices_selected(c(0.95, 0.9, 0.8), 0.95,
keep_order = TRUE),
time_points,
time_unit_var =
teal.transform::choices_selected(teal.transform::variable_choices(dataname, "AVALU"),
"AVALU", fixed = TRUE),
event_desc_var = teal.transform::choices_selected("EVNTDESC", "EVNTDESC", fixed = TRUE),
add_total = FALSE,
total_label = default_total_label(),
na_level = default_na_str(),
pre_output = NULL,
post_output = NULL,
basic_table_args = teal.widgets::basic_table_args(),
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dataname |
( |
parentname |
( |
arm_var |
( |
arm_ref_comp |
( |
paramcd |
( |
strata_var |
( |
aval_var |
( |
cnsr_var |
( |
conf_level_coxph |
( |
conf_level_survfit |
( |
time_points |
( |
time_unit_var |
( |
event_desc_var |
( |
add_total |
( |
total_label |
( |
na_level |
( |
pre_output |
( |
post_output |
( |
basic_table_args |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Details
The core functionality of this module is based on
tern::coxph_pairwise()
,tern::surv_timepoint()
, andtern::surv_time()
from thetern
package.The arm and stratification variables are taken from the
parentname
data.The following variables are used in the module:
-
AVAL
: time to event -
CNSR
: 1 if record inAVAL
is censored, 0 otherwise -
PARAMCD
: variable used to filter for endpoint (e.g. OS). After filtering forPARAMCD
one observation per patient is expected
-
Value
a teal_module
object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
-
table
(TableTree
- output ofrtables::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_tte( ..., # 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.
Examples in Shinylive
- example-1
See Also
The TLG Catalog where additional example apps implementing this module can be found.
Examples
data <- teal_data()
data <- within(data, {
ADSL <- tmc_ex_adsl
ADTTE <- tmc_ex_adtte
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
ADSL <- data[["ADSL"]]
ADTTE <- data[["ADTTE"]]
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_tte(
label = "Time To Event Table",
dataname = "ADTTE",
arm_var = choices_selected(
variable_choices(ADSL, c("ARM", "ARMCD", "ACTARMCD")),
"ARM"
),
arm_ref_comp = arm_ref_comp,
paramcd = choices_selected(
value_choices(ADTTE, "PARAMCD", "PARAM"),
"OS"
),
strata_var = choices_selected(
variable_choices(ADSL, c("SEX", "BMRKR2")),
"SEX"
),
time_points = choices_selected(c(182, 243), 182),
event_desc_var = choices_selected(
variable_choices(ADTTE, "EVNTDESC"),
"EVNTDESC",
fixed = TRUE
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
Check if vector is valid as to be used as a treatment arm variable
Description
Check if vector is valid as to be used as a treatment arm variable
Usage
validate_arm(arm_vec)
Arguments
arm_vec |
vector to be validated |
Details
A validate error is returned if the vector is not a factor with a more detailed error message if any of the entries are empty strings
Validate standard input values for a teal module
Description
Usage
validate_standard_inputs(
adsl,
adslvars = character(0),
anl,
anlvars = character(0),
need_arm = TRUE,
arm_var,
ref_arm,
comp_arm,
min_n_levels_armvar = 1L,
max_n_levels_armvar = 100L,
min_nrow = 1
)
Arguments
adsl |
data.frame with subject-level data |
adslvars |
required variables from |
anl |
data.frame with analysis data |
anlvars |
required variables from |
need_arm |
flag indicating whether grouping variable |
arm_var |
character with name of grouping variable, typically arm |
ref_arm |
character with name of reference level in |
comp_arm |
character with name for comparison level in |
min_n_levels_armvar |
minimum number of levels in grouping variable |
max_n_levels_armvar |
maximum number of levels in grouping variable |
min_nrow |
minimum number of observations in |