Outliers Module
tm_outliers.Rd
Module to analyze and identify outliers using different methods
Usage
tm_outliers(
label = "Outliers Module",
outlier_var,
categorical_var = NULL,
ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void",
"test"),
ggplot2_args = teal.widgets::ggplot2_args(),
plot_height = c(600, 200, 2000),
plot_width = NULL,
pre_output = NULL,
post_output = NULL
)
Arguments
- label
(
character
) Label shown in the navigation item for the module.- outlier_var
(
data_extract_spec
orlist
of multipledata_extract_spec
) variable to consider for the outliers analysis.- categorical_var
(
data_extract_spec
orlist
of multipledata_extract_spec
) categorical factor to split the selected outlier variables on.- ggtheme
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"
.- 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", "Boxplot","Density plot","Cumulative distribution plot")
.For more details see the vignette:
vignette("custom-ggplot2-arguments", package = "teal.widgets")
. - 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.- 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.
Examples
library(scda)
ADSL <- synthetic_cdisc_data("latest")$adsl
fact_vars_adsl <- names(Filter(isTRUE, sapply(ADSL, is.factor)))
vars <- choices_selected(variable_choices(ADSL, fact_vars_adsl))
app <- init(
data = cdisc_data(
cdisc_dataset("ADSL", ADSL, code = "ADSL <- synthetic_cdisc_data(\"latest\")$adsl"),
check = TRUE
),
modules = modules(
tm_outliers(
outlier_var = list(
data_extract_spec(
dataname = "ADSL",
select = select_spec(
label = "Select variable:",
choices = variable_choices(ADSL, c("AGE", "BMRKR1")),
selected = "AGE",
multiple = FALSE,
fixed = FALSE
)
)
),
categorical_var = data_extract_spec(
dataname = "ADSL",
filter = filter_spec(
vars = vars,
choices = value_choices(ADSL, vars$selected),
selected = value_choices(ADSL, vars$selected),
multiple = TRUE
)
),
ggplot2_args = teal.widgets::ggplot2_args(labs = list(subtitle = "Plot generated by Outliers Module"))
)
)
)
#> [INFO] 2022-06-14 17:42:48.7637 pid:1110 token:[] teal.modules.general Initializing tm_outliers
if (FALSE) {
shinyApp(app$ui, app$server)
}