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,
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
)
Arguments
label |
( |
plot_height |
( |
plot_width |
( |
parent_dataname |
( |
ggtheme |
( |
ggplot2_args |
( List names should match the following: For more details see the vignette: |
pre_output |
( |
post_output |
( |
Value
Object of class teal_module
to be used in teal
applications.
Examples
library(teal.widgets)
# module specification used in apps below
tm_missing_data_module <- tm_missing_data(
ggplot2_args = list(
"Combinations Hist" = ggplot2_args(
labs = list(subtitle = "Plot produced by Missing Data Module", caption = NULL)
),
"Combinations Main" = ggplot2_args(labs = list(title = NULL))
)
)
# 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"]])
})
datanames(data) <- c("iris", "mtcars")
app <- init(
data = data,
modules = modules(tm_missing_data_module)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
# CDISC example data
data <- teal_data()
data <- within(data, {
require(nestcolor)
ADSL <- rADSL
ADRS <- rADRS
})
datanames(data) <- c("ADSL", "ADRS")
join_keys(data) <- default_cdisc_join_keys[datanames(data)]
app <- init(
data = data,
modules = modules(tm_missing_data_module)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}