tm_missing_data {teal.modules.general} | R Documentation |
teal
module: Missing data analysis
Description
This module analyzes missing data in data.frame
s 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 |
( |
plot_height |
( |
plot_width |
( |
datanames |
(
|
parent_dataname |
( |
ggtheme |
( |
ggplot2_args |
( List names should match the following: For more details see the vignette: |
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:
-
summary_plot
(grob
created withggplot2::ggplotGrob()
) -
combination_plot
(grob
created withggplot2::ggplotGrob()
) -
by_subject_plot
(ggplot
) -
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_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 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.
Examples in Shinylive
- example-1
- example-2
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")
)
)
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()
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}