tm_outliers | R Documentation |
teal
module: Outliers analysisModule to analyze and identify outliers using different methods such as IQR, Z-score, and Percentiles, and offers visualizations including box plots, density plots, and cumulative distribution plots to help interpret the outliers.
tm_outliers(
label = "Outliers Module",
outlier_var,
categorical_var = NULL,
ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"),
ggplot2_args = teal.widgets::ggplot2_args(),
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:
box_plot
(ggplot
)
density_plot
(ggplot
)
cumulative_plot
(ggplot
)
table
(datatables
created with 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_outliers( ..., # arguments for module decorators = list( box_plot = teal_transform_module(...), # applied only to `box_plot` output density_plot = teal_transform_module(...), # applied only to `density_plot` output cumulative_plot = teal_transform_module(...), # applied only to `cumulative_plot` output table = teal_transform_module(...) # applied only to `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.
# general data example
data <- teal_data()
data <- within(data, {
CO2 <- CO2
CO2[["primary_key"]] <- seq_len(nrow(CO2))
})
join_keys(data) <- join_keys(join_key("CO2", "CO2", "primary_key"))
vars <- choices_selected(variable_choices(data[["CO2"]], c("Plant", "Type", "Treatment")))
app <- init(
data = data,
modules = modules(
tm_outliers(
outlier_var = list(
data_extract_spec(
dataname = "CO2",
select = select_spec(
label = "Select variable:",
choices = variable_choices(data[["CO2"]], c("conc", "uptake")),
selected = "uptake",
multiple = FALSE,
fixed = FALSE
)
)
),
categorical_var = list(
data_extract_spec(
dataname = "CO2",
filter = filter_spec(
vars = vars,
choices = value_choices(data[["CO2"]], vars$selected),
selected = value_choices(data[["CO2"]], vars$selected),
multiple = TRUE
)
)
)
)
)
)
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)]
fact_vars_adsl <- names(Filter(isTRUE, sapply(data[["ADSL"]], is.factor)))
vars <- choices_selected(variable_choices(data[["ADSL"]], fact_vars_adsl))
app <- init(
data = data,
modules = modules(
tm_outliers(
outlier_var = list(
data_extract_spec(
dataname = "ADSL",
select = select_spec(
label = "Select variable:",
choices = variable_choices(data[["ADSL"]], c("AGE", "BMRKR1")),
selected = "AGE",
multiple = FALSE,
fixed = FALSE
)
)
),
categorical_var = list(
data_extract_spec(
dataname = "ADSL",
filter = filter_spec(
vars = vars,
choices = value_choices(data[["ADSL"]], vars$selected),
selected = value_choices(data[["ADSL"]], vars$selected),
multiple = TRUE
)
)
)
)
)
)
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.