This module analyzes missing data in data.frames to help users explore missing observations and
gain insights into the completeness of their data.
It is useful for clinical data analysis within the context of CDISC standards and
adaptable for general data analysis purposes.
Usage
tm_missing_data(
label = "Missing data",
plot_height = c(600, 400, 5000),
plot_width = NULL,
datanames = "all",
parent_dataname = "ADSL",
ggtheme = c("classic", "gray", "bw", "linedraw", "light", "dark", "minimal", "void"),
ggplot2_args = list(`Combinations Hist` = teal.widgets::ggplot2_args(labs =
list(caption = NULL)), `Combinations Main` = teal.widgets::ggplot2_args(labs =
list(title = NULL))),
pre_output = NULL,
post_output = NULL,
transformators = list(),
decorators = list()
)Arguments
- label
(
character(1)) Label shown in the navigation item for the module or module group. Formodules()defaults to"root". SeeDetails.- plot_height
(
numeric) optional, specifies the plot height as a three-element vector ofvalue,min, andmaxintended for use with a slider UI element.- plot_width
(
numeric) optional, specifies the plot width as a three-element vector ofvalue,min, andmaxfor a slider encoding the plot width.- datanames
-
(
character) Names of the datasets relevant to the item. There are 2 reserved values that have specific behaviors:The keyword
"all"includes all datasets available in the data passed to the teal application.NULLhides the sidebar panel completely.If
transformatorsare specified, theirdatanamesare automatically added to thisdatanamesargument.
- parent_dataname
(
character(1)) Specifies the parent dataset name. Default isADSLforCDISCdata. If provided and exists, enables additional analysis "by subject". For non-CDISCdata, this parameter can be ignored.- ggtheme
(
character) optional, specifies the defaultggplot2theme for plots. Defaults toclassic.- ggplot2_args
-
(
ggplot2_args) optional, object created byteal.widgets::ggplot2_args()with settings for all the plots or named list ofggplot2_argsobjects for plot-specific settings. The argument is merged with options variableteal.ggplot2_argsand default module setup.List names should match the following:
c("default", "Summary Obs", "Summary Patients", "Combinations Main", "Combinations Hist", "By Subject").For more details see the vignette:
vignette("custom-ggplot2-arguments", package = "teal.widgets"). - 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.- transformators
(
listofteal_transform_module) that will be applied to transform module's data input. To learn more checkvignette("transform-input-data", package = "teal").- decorators
-
(named
listof lists ofteal_transform_module) optional, decorator for tables or plots included in the module output reported. The decorators are applied to the respective output objects.See section "Decorating Module" below for more details.
Decorating Module
This module generates the following objects, which can be modified in place using decorators:
summary_plot(grobcreated withggplot2::ggplotGrob())combination_plot(grobcreated withggplot2::ggplotGrob())by_subject_plot(ggplot)
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_missing_data(
..., # arguments for module
decorators = list(
summary_plot = teal_transform_module(...), # applied only to `summary_plot` output
combination_plot = teal_transform_module(...), # applied only to `combination_plot` output
by_subject_plot = teal_transform_module(...) # applied only to `by_subject_plot` 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
# general example data
data <- teal_data()
data <- within(data, {
require(nestcolor)
add_nas <- function(x) {
x[sample(seq_along(x), floor(length(x) * runif(1, .05, .17)))] <- NA
x
}
iris <- iris
mtcars <- mtcars
iris[] <- lapply(iris, add_nas)
mtcars[] <- lapply(mtcars, add_nas)
mtcars[["cyl"]] <- as.factor(mtcars[["cyl"]])
mtcars[["gear"]] <- as.factor(mtcars[["gear"]])
})
app <- init(
data = data,
modules = modules(
tm_missing_data(parent_dataname = "mtcars")
)
)
#> Initializing tm_missing_data
if (interactive()) {
shinyApp(app$ui, app$server)
}
# CDISC example data
data <- teal_data()
data <- within(data, {
require(nestcolor)
ADSL <- teal.data::rADSL
ADRS <- rADRS
})
join_keys(data) <- default_cdisc_join_keys[names(data)]
app <- init(
data = data,
modules = modules(
tm_missing_data()
)
)
#> Initializing tm_missing_data
if (interactive()) {
shinyApp(app$ui, app$server)
}