tm_g_distribution {teal.modules.general} | R Documentation |
teal
module: Distribution analysis
Description
Module is designed to explore the distribution of a single variable within a given dataset. It offers several tools, such as histograms, Q-Q plots, and various statistical tests to visually and statistically analyze the variable's distribution.
Usage
tm_g_distribution(
label = "Distribution Module",
dist_var,
strata_var = NULL,
group_var = NULL,
freq = FALSE,
ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"),
ggplot2_args = teal.widgets::ggplot2_args(),
bins = c(30L, 1L, 100L),
plot_height = c(600, 200, 2000),
plot_width = NULL,
pre_output = NULL,
post_output = NULL,
transformators = list(),
decorators = list()
)
Arguments
label |
( |
dist_var |
( |
strata_var |
( |
group_var |
( |
freq |
( |
ggtheme |
( |
ggplot2_args |
( List names should match the following: For more details see the vignette: |
bins |
(
|
plot_height |
( |
plot_width |
( |
pre_output |
( |
post_output |
( |
transformators |
( |
decorators |
See section "Decorating Module" below for more details. |
Value
Object of class teal_module
to be used in teal
applications.
Decorating Module
This module generates the following objects, which can be modified in place using decorators::
-
histogram_plot
(ggplot
) -
qq_plot
(ggplot
) -
summary_table
(datatables
created withDT::datatable()
) -
test_table
(datatables
created withDT::datatable()
)
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_distribution( ..., # arguments for module decorators = list( histogram_plot = teal_transform_module(...), # applied only to `histogram_plot` output qq_plot = teal_transform_module(...), # applied only to `qq_plot` output summary_table = teal_transform_module(...), # applied only to `summary_table` output test_table = teal_transform_module(...) # applied only to `test_table` 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.
Examples in Shinylive
- example-1
- example-2
Examples
# general data example
data <- teal_data()
data <- within(data, {
iris <- iris
})
app <- init(
data = data,
modules = list(
tm_g_distribution(
dist_var = data_extract_spec(
dataname = "iris",
select = select_spec(variable_choices("iris"), "Petal.Length")
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
# CDISC data example
data <- teal_data()
data <- within(data, {
ADSL <- teal.data::rADSL
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
vars1 <- choices_selected(
variable_choices(data[["ADSL"]], c("ARM", "COUNTRY", "SEX")),
selected = NULL
)
app <- init(
data = data,
modules = modules(
tm_g_distribution(
dist_var = data_extract_spec(
dataname = "ADSL",
select = select_spec(
choices = variable_choices(data[["ADSL"]], c("AGE", "BMRKR1")),
selected = "BMRKR1",
multiple = FALSE,
fixed = FALSE
)
),
strata_var = data_extract_spec(
dataname = "ADSL",
filter = filter_spec(
vars = vars1,
multiple = TRUE
)
),
group_var = data_extract_spec(
dataname = "ADSL",
filter = filter_spec(
vars = vars1,
multiple = TRUE
)
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}