Stack Plots of variables and show association with reference variable
tm_g_association.Rd
Stack Plots of variables and show association with reference variable
Usage
tm_g_association(
label = "Association",
ref,
vars,
show_association = TRUE,
plot_height = c(600, 400, 5000),
plot_width = NULL,
distribution_theme = c("gray", "bw", "linedraw", "light", "dark", "minimal",
"classic", "void", "test"),
association_theme = c("gray", "bw", "linedraw", "light", "dark", "minimal",
"classic", "void", "test"),
pre_output = NULL,
post_output = NULL,
ggplot2_args = teal.widgets::ggplot2_args()
)
Arguments
- label
(
character
) Label shown in the navigation item for the module.- ref
(
data_extract_spec
orlist
of multipledata_extract_spec
) reference variable, must setmultiple = FALSE
.- vars
(
data_extract_spec
orlist
of multipledata_extract_spec
) associated variables.- show_association
optional, (
logical
) Whether show association ofvars
with reference variable. Defaults toTRUE
.- plot_height
optional, (
numeric
) A vector of length three withc(value, min and max)
for a slider encoding the plot height.- plot_width
optional, (
numeric
) A vector of length three withc(value, min and max)
for a slider encoding the plot width.- distribution_theme
optional, (
character
)ggplot2
theme to be used by default. One ofc("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test")
. Each theme can be chosen by the user during the session. Defaults to"gray"
.- association_theme
optional, (
character
)ggplot2
theme to be used by default. One ofc("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void", "test")
. Each theme can be chosen by the user during the session. Defaults to"gray"
.- 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.- ggplot2_args
-
optional, (
ggplot2_args
) object created byteal.widgets::ggplot2_args()
with settings for all the plots or named list ofggplot2_args
objects for plot-specific settings. The argument is merged with options variableteal.ggplot2_args
and default module setup.List names should match the following:
c("default", "Bivariate1", "Bivariate2")
.For more details see the vignette:
vignette("custom-ggplot2-arguments", package = "teal.widgets")
.
Note
For more examples, please see the vignette "Using association plot" via
vignette("using-association-plot", package = "teal.modules.general")
.
Examples
# Association plot of selected reference variable (SEX)
# against other selected variables (BMRKR1)
library(scda)
ADSL <- synthetic_cdisc_data("latest")$adsl
app <- init(
data = cdisc_data(
cdisc_dataset("ADSL", ADSL, code = "ADSL <- synthetic_cdisc_data(\"latest\")$adsl"),
check = TRUE
),
modules = modules(
tm_g_association(
ref = data_extract_spec(
dataname = "ADSL",
select = select_spec(
label = "Select variable:",
choices = variable_choices(
ADSL,
c("SEX", "RACE", "COUNTRY", "ARM", "STRATA1", "STRATA2", "ITTFL", "BMRKR2")
),
selected = "RACE",
fixed = FALSE
)
),
vars = data_extract_spec(
dataname = "ADSL",
select = select_spec(
label = "Select variables:",
choices = variable_choices(
ADSL,
c("SEX", "RACE", "COUNTRY", "ARM", "STRATA1", "STRATA2", "ITTFL", "BMRKR2")
),
selected = "BMRKR2",
multiple = TRUE,
fixed = FALSE
)
),
ggplot2_args = teal.widgets::ggplot2_args(labs = list(subtitle = "Plot generated by Association Module"))
)
)
)
#> [INFO] 2022-06-14 17:42:29.5656 pid:1110 token:[] teal.modules.general Initializing tm_g_association
if (FALSE) {
shinyApp(app$ui, app$server)
}