Usage
tm_g_swimlane(
label,
dataname,
bar_var,
bar_color_var = NULL,
sort_var = NULL,
marker_pos_var = NULL,
marker_shape_var = NULL,
marker_shape_opt = NULL,
marker_color_var = NULL,
marker_color_opt = NULL,
anno_txt_var = NULL,
vref_line = NULL,
plot_height = c(1200L, 400L, 5000L),
plot_width = NULL,
pre_output = NULL,
post_output = NULL,
x_label = "Time from First Treatment (Day)"
)
Arguments
- label
(
character(1)
)
menu item label of the module in the teal app.- dataname
analysis data used for plotting, needs to be available in the list passed to the
data
argument ofteal::init()
. If no markers are to be plotted in the module,"ADSL"
should be the input. If markers are to be plotted, data name for the marker data should be the input- bar_var
teal.transform::choices_selected subject-level numeric variable from dataset to plot as the bar length
- bar_color_var
teal.transform::choices_selected color by variable (subject-level)
- sort_var
choices_selected
sort by variable (subject-level)- marker_pos_var
teal.transform::choices_selected variable for marker position from marker data (Note: make sure that marker position has the same relative start day as bar length variable
bar_var
- marker_shape_var
teal.transform::choices_selected marker shape variable from marker data
- marker_shape_opt
aesthetic values to map shape values (named vector to map shape values to each name). If not
NULL
, please make sure this contains all possible values formarker_shape_var
values, otherwise shape will be assigned byggplot
default- marker_color_var
marker color variable from marker data
- marker_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 formarker_color_var
values, otherwise color will be assigned byggplot
default- anno_txt_var
character vector with subject-level variable names that are selected as annotation
- vref_line
vertical reference lines
- 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.- x_label
the label of the x axis
Value
the teal::module()
object.
Author
Ting Qi (qit3) qit3@gene.com
Examples
# Example using stream (ADaM) dataset
data <- teal_data() |>
within({
library(dplyr)
ADSL <- rADSL %>%
mutate(TRTDURD = as.integer(TRTEDTM - TRTSDTM) + 1) %>%
filter(STRATA1 == "A" & ARMCD == "ARM A")
ADRS <- rADRS %>%
filter(PARAMCD == "LSTASDI" & DCSREAS == "Death") %>%
mutate(AVALC = DCSREAS, ADY = EOSDY) %>%
rbind(rADRS %>% filter(PARAMCD == "OVRINV" & AVALC != "NE")) %>%
arrange(USUBJID)
})
datanames(data) <- c("ADSL", "ADRS")
join_keys(data) <- default_cdisc_join_keys[datanames(data)]
ADSL <- data[["ADSL"]]
ADRS <- data[["ADRS"]]
app <- init(
data = data,
modules = modules(
tm_g_swimlane(
label = "Swimlane Plot",
dataname = "ADRS",
bar_var = choices_selected(
selected = "TRTDURD",
choices = c("TRTDURD", "EOSDY")
),
bar_color_var = choices_selected(
selected = "EOSSTT",
choices = c("EOSSTT", "ARM", "ARMCD", "ACTARM", "ACTARMCD", "SEX")
),
sort_var = choices_selected(
selected = "ACTARMCD",
choices = c("USUBJID", "SITEID", "ACTARMCD", "TRTDURD")
),
marker_pos_var = choices_selected(
selected = "ADY",
choices = c("ADY")
),
marker_shape_var = choices_selected(
selected = "AVALC",
c("AVALC", "AVISIT")
),
marker_shape_opt = c("CR" = 16, "PR" = 17, "SD" = 18, "PD" = 15, "Death" = 8),
marker_color_var = choices_selected(
selected = "AVALC",
choices = c("AVALC", "AVISIT")
),
marker_color_opt = c(
"CR" = "green", "PR" = "blue", "SD" = "goldenrod",
"PD" = "red", "Death" = "black"
),
vref_line = c(30, 60),
anno_txt_var = choices_selected(
selected = c("ACTARM", "SEX"),
choices = c(
"ARM", "ARMCD", "ACTARM", "ACTARMCD", "AGEGR1",
"SEX", "RACE", "COUNTRY", "DCSREAS", "DCSREASP"
)
)
)
)
)
#> Initializing tm_g_swimlane
#> Initializing reporter_previewer_module
if (interactive()) {
shinyApp(app$ui, app$server)
}