View source: R/tm_g_distribution.R
| tm_g_distribution | R Documentation |
teal module: Distribution analysisModule 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.
tm_g_distribution(
label = "Distribution Module",
dist_var = teal.picks::picks(teal.picks::datasets(), teal.picks::variables(is.numeric),
teal.picks::values()),
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()
)
Object of class teal_module to be used in teal applications.
This module generates the following objects, which can be modified in place using decorators::
histogram_plot (ggplot)
qq_plot (ggplot)
summary_table (DT::datatable)
test_table (DT::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.
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")
# general data example
data <- teal_data()
data <- within(data, {
iris <- iris
})
app <- init(
data = data,
modules = list(
tm_g_distribution(
dist_var = teal.picks::picks(
datasets("iris"),
teal.picks::variables(is.numeric),
teal.picks::values()
)
)
)
)
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)]
app <- init(
data = data,
modules = modules(
tm_g_distribution(
dist_var = teal.picks::picks(
datasets("ADSL"),
teal.picks::variables(c("BMRKR1", "AGE")),
values(multiple = FALSE)
),
strata_var = teal.picks::picks(
datasets("ADSL"),
teal.picks::variables(c("ARM", "COUNTRY", "SEX"), selected = NULL)
),
group_var = teal.picks::picks(
datasets("ADSL"),
teal.picks::variables(c("ARM", "COUNTRY", "SEX"), selected = NULL)
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.