This is teal module that generates a waterfall plot for ADaM data
Usage
tm_g_waterfall(
label,
dataname_tr = "ADTR",
dataname_rs = "ADRS",
bar_paramcd,
bar_var,
bar_color_var,
bar_color_opt = NULL,
sort_var,
add_label_var_sl,
add_label_paramcd_rs,
anno_txt_var_sl,
anno_txt_paramcd_rs,
facet_var,
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()
)Arguments
- label
(
character(1)) Label shown in the navigation item for the module or module group. Formodules()defaults to"root". SeeDetails.- dataname_tr
tumor burden analysis data used in teal module to plot as bar height, needs to be available in the list passed to the
dataargument ofteal::init()- dataname_rs
response analysis data used in teal module to label response parameters, needs to be available in the list passed to the
dataargument ofteal::init()- bar_paramcd
choices_selectedparameter in tumor burden data that will be plotted as bar height- bar_var
choices_selectednumeric variable from dataset to plot the bar height, e.g.,PCHG- bar_color_var
choices_selectedcolor by variable (subject level),Nonecorresponds toNULL- 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
choices_selectedsort by variable (subject level),Nonecorresponds toNULL- add_label_var_sl
choices_selectedadd label to bars (subject level),Nonecorresponds toNULL- add_label_paramcd_rs
choices_selectedadd label to bars (response dataset),Nonecorresponds toNULL. At least one ofadd_label_var_slandadd_label_paramcd_rsneeds to beNULL- anno_txt_var_sl
choices_selectedsubject level variables to be displayed in the annotation table, default isNULL- anno_txt_paramcd_rs
choices_selectedanalysis dataset variables to be displayed in the annotation table, default isNULL- facet_var
choices_selectedfacet by variable (subject level),Nonecorresponds toNULL- ytick_at
bar height axis interval, default is 20
- href_line
numeric vector to plot horizontal reference lines, default is
NULL- gap_point_val
singular numeric value for adding bar break when some bars are significantly higher than others, default is
NULL- show_value
boolean of whether value of bar height is shown, default is
TRUE- 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").
Value
the teal::module() object.
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 <- teal_data() %>%
within({
library(nestcolor)
ADSL <- rADSL
ADRS <- rADRS
ADTR <- 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 = choices_selected(c("SLDINV"), "SLDINV"),
bar_var = choices_selected(c("PCHG", "AVAL"), "PCHG"),
bar_color_var = choices_selected(c("ARMCD", "SEX"), "ARMCD"),
bar_color_opt = NULL,
sort_var = choices_selected(c("ARMCD", "SEX"), NULL),
add_label_var_sl = choices_selected(c("SEX", "EOSDY"), NULL),
add_label_paramcd_rs = choices_selected(c("BESRSPI", "OBJRSPI"), NULL),
anno_txt_var_sl = choices_selected(c("SEX", "ARMCD", "BMK1", "BMK2"), NULL),
anno_txt_paramcd_rs = choices_selected(c("BESRSPI", "OBJRSPI"), NULL),
facet_var = choices_selected(c("SEX", "ARMCD", "STRATA1", "STRATA2"), NULL),
href_line = "-30, 20"
)
)
)
#> Initializing tm_g_waterfall
if (interactive()) {
shinyApp(app$ui, app$server)
}