Module provides provides a detailed summary and visualization of variable distributions
for data.frame
objects, with interactive features to customize analysis.
Usage
tm_variable_browser(
label = "Variable Browser",
datasets_selected = character(0),
parent_dataname = "ADSL",
pre_output = NULL,
post_output = NULL,
ggplot2_args = teal.widgets::ggplot2_args()
)
Arguments
- label
(
character(1)
) Label shown in the navigation item for the module or module group. Formodules()
defaults to"root"
. SeeDetails
.- datasets_selected
(
character
) vector of datasets which should be shown, in order. Names must correspond with datasets names. If vector of length zero (default) then all datasets are shown. Note: Onlydata.frame
objects are compatible; using other types will cause an error.- parent_dataname
(
character(1)
) string specifying a parent dataset. If it exists indatasets_selected
then an extra checkbox will be shown to allow users to not show variables in other datasets which exist in thisdataname
. This is typically used to removeADSL
columns inCDISC
data. In nonCDISC
data this can be ignored. Defaults to"ADSL"
.- pre_output
(
shiny.tag
) optional, text or UI element to be displayed before the module's output, providing context or a title. with text placed before the output to put the output into context. For example a title.- post_output
(
shiny.tag
) optional, text or UI element to be displayed after the module's output, adding context or further instructions. Elements likeshiny::helpText()
are useful.- ggplot2_args
-
(
ggplot2_args
) object created byteal.widgets::ggplot2_args()
with settings for the module plot. The argument is merged with options variableteal.ggplot2_args
and default module setup.For more details see the vignette:
vignette("custom-ggplot2-arguments", package = "teal.widgets")
Details
Numeric columns with fewer than 30 distinct values can be treated as either discrete or continuous with a checkbox allowing users to switch how they are treated(if < 6 unique values then the default is discrete, otherwise it is continuous).
Examples
library(teal.widgets)
# Module specification used in apps below
tm_variable_browser_module <- tm_variable_browser(
label = "Variable browser",
ggplot2_args = ggplot2_args(
labs = list(subtitle = "Plot generated by Variable Browser Module")
)
)
#> [INFO] 2024-03-01 20:55:32.9822 pid:1280 token:[] teal.modules.general Initializing tm_variable_browser
# general data example
data <- teal_data()
data <- within(data, {
iris <- iris
mtcars <- mtcars
women <- women
faithful <- faithful
CO2 <- CO2
})
datanames(data) <- c("iris", "mtcars", "women", "faithful", "CO2")
app <- init(
data = data,
modules = modules(tm_variable_browser_module)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
# CDISC example data
data <- teal_data()
data <- within(data, {
ADSL <- rADSL
ADTTE <- rADTTE
})
datanames(data) <- c("ADSL", "ADTTE")
join_keys(data) <- default_cdisc_join_keys[datanames(data)]
app <- init(
data = data,
modules = modules(tm_variable_browser_module)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}