This is teal module that generates a waterfall plot for ADaM data
Usage
tm_g_waterfall(
label,
parentname = "ADSL",
dataname_tr = "ADTR",
dataname_rs = "ADRS",
bar_paramcd = teal.picks::values(choices = teal.picks::is_categorical(), multiple =
FALSE),
bar_var = teal.picks::variables(choices = is.numeric, multiple = FALSE),
bar_color_var = teal.picks::variables(choices = teal.picks::is_categorical(max.len =
20), selected = NULL),
bar_color_opt = NULL,
sort_var = teal.picks::variables(selected = NULL),
add_label_var_sl = teal.picks::variables(selected = NULL),
add_label_paramcd_rs = teal.picks::values(selected = NULL, multiple = FALSE),
anno_txt_var_sl = teal.picks::variables(selected = NULL, multiple = TRUE),
anno_txt_paramcd_rs = teal.picks::values(selected = NULL),
facet_var = teal.picks::variables(selected = NULL),
ytick_at = 20,
href_line = NULL,
gap_point_val = NULL,
show_value = TRUE,
plot_height = c(1200L, 400L, 5000L),
plot_width = NULL,
pre_output = NULL,
post_output = NULL,
transformators = list(),
decorators = list()
)Arguments
- label
(
character(1)) Label shown in the navigation item for the module or module group. Formodules()defaults to"root". SeeDetails.- parentname
(
character(1))
analysis data used for several variables in the teal module, needs to be available in the list passed to thedataargument ofteal::init(). The default is"ADSL"- dataname_tr
(
character(1)) tumor burden analysis data used in teal module to plot as bar height, needs to be available in the list passed to thedataargument ofteal::init()- dataname_rs
(
character(1)) response analysis data used in teal module to label response parameters, needs to be available in the list passed to thedataargument ofteal::init()- bar_paramcd
Either a (
teal.picks::values()) object or a (teal.transform::choices_selected()) object.choices_selected()is being deprecated as an argument type and will be removed in the future. Parameter in tumor burden data that will be plotted as bar height.- bar_var
Either a (
teal.picks::variables()) object or a (teal.transform::choices_selected()) object.choices_selected()is being deprecated as an argument type and will be removed in the future. Numeric variable from dataset to plot the bar height, e.g.,PCHG.- bar_color_var
Either a (
teal.picks::variables()) object or a (teal.transform::choices_selected()) object.choices_selected()is being deprecated as an argument type and will be removed in the future. Color by variable (subject level). Defaults to no selection.- bar_color_opt
aesthetic values to map color values (named vector to map color values to each name). If not
NULL, please make sure this contains all possible values forbar_color_varvalues, otherwise color will be assigned byggplotdefault, please note thatNULLneeds to be specified in this case- sort_var
Either a (
teal.picks::variables()) object or a (teal.transform::choices_selected()) object.choices_selected()is being deprecated as an argument type and will be removed in the future. Sort by variable (subject level). Defaults to no selection.- add_label_var_sl
Either a (
teal.picks::variables()) object or a (teal.transform::choices_selected()) object.choices_selected()is being deprecated as an argument type and will be removed in the future. Add label to bars (subject level).- add_label_paramcd_rs
Either a (
teal.picks::values()) object or a (teal.transform::choices_selected()) object.choices_selected()is being deprecated as an argument type and will be removed in the future. Add label to bars (response dataset). At least one ofadd_label_var_slandadd_label_paramcd_rsneeds to not be selected.- anno_txt_var_sl
Either a (
teal.picks::variables()) object or a (teal.transform::choices_selected()) object.choices_selected()is being deprecated as an argument type and will be removed in the future. Subject level variables to be displayed in the annotation table, default is no selection.- anno_txt_paramcd_rs
Either a (
teal.picks::values()) object or a (teal.transform::choices_selected()) object.choices_selected()is being deprecated as an argument type and will be removed in the future. Analysis dataset variables to be displayed in the annotation table, default is no selection.- facet_var
Either a (
teal.picks::variables()) object or a (teal.transform::choices_selected()) object.choices_selected()is being deprecated as an argument type and will be removed in the future. Facet by variable (subject level). Defaults to no selection.- ytick_at
(
numeric(1)) bar height axis interval, default is 20- href_line
(
numeric) numeric vector to plot horizontal reference lines, default isNULL- gap_point_val
(
numeric(1)) singular numeric value for adding bar break when some bars are significantly higher than others, default isNULL- show_value
(
logical(1)) boolean of whether value of bar height is shown, default isTRUE- plot_height
(
numeric(3))
vector to indicate default value, minimum and maximum values.- plot_width
(
numeric(3))
vector to indicate default value, minimum and maximum values.- pre_output
(
shiny.tag) optional,
with text placed before the output to put the output into context. For example a title.- post_output
(
shiny.tag) optional, with text placed after the output to put the output into context. For example theshiny::helpText()elements are useful.- transformators
(
listofteal_transform_module) that will be applied to transform module's data input. To learn more checkvignette("transform-input-data", package = "teal").- decorators
(named
listofteal_transform_module) optional, decorators for the moduleplotoutput.
Value
the teal::module() object.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
plot(grob,gtable)
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_butterfly(
..., # arguments for module
decorators = list(
plot = teal_transform_module(...), # applied to the `plot` output
)
)
For additional details and examples of decorators, refer to the vignette
vignette("decorate-module-output", package = "teal.modules.general").
To learn more please refer to the vignette
vignette("transform-module-output", package = "teal") or the teal::teal_transform_module() documentation.
Reporting
This module returns an object of class teal_module, that contains a server function.
Since the server function returns a teal_report object, this makes this module reportable, which means that
the reporting functionality will be turned on automatically by the teal framework.
For more information on reporting in teal, see the vignettes:
vignette("reportable-shiny-application", package = "teal.reporter")vignette("adding-support-for-reporting-to-custom-modules", package = "teal")
Examples
data <- within(teal_data(), {
library(nestcolor)
ADSL <- teal.data::rADSL
ADRS <- teal.data::rADRS
ADTR <- teal.data::rADTR
ADSL$SEX <- factor(ADSL$SEX, levels = unique(ADSL$SEX))
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
app <- init(
data = data,
modules = modules(
tm_g_waterfall(
label = "Waterfall",
dataname_tr = "ADTR",
dataname_rs = "ADRS",
bar_paramcd = values(c("SLDINV"), "SLDINV", multiple = FALSE),
bar_var = variables(c("PCHG", "AVAL"), "PCHG"),
bar_color_var = variables(c("ARMCD", "SEX"), "ARMCD"),
bar_color_opt = NULL,
sort_var = variables(c("ARMCD", "SEX"), NULL),
add_label_var_sl = variables(c("SEX", "EOSDY"), NULL),
add_label_paramcd_rs = values(c("BESRSPI", "OBJRSPI"), NULL, multiple = FALSE),
anno_txt_var_sl = variables(c("SEX", "ARMCD", "BMK1", "BMK2"), NULL, multiple = TRUE),
anno_txt_paramcd_rs = values(c("BESRSPI", "OBJRSPI"), NULL),
facet_var = variables(c("SEX", "ARMCD", "STRATA1", "STRATA2"), NULL),
href_line = "-30, 20"
)
)
)
#> Initializing tm_g_waterfall
if (interactive()) {
shinyApp(app$ui, app$server)
}