Skip to contents

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,
  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

(character(1)) Label shown in the navigation item for the module or module group. For modules() defaults to "root". See Details.

plot_height

(numeric) optional, specifies the plot height as a three-element vector of value, min, and max intended for use with a slider UI element.

plot_width

(numeric) optional, specifies the plot width as a three-element vector of value, min, and max for a slider encoding the plot width.

parent_dataname

(character(1)) Specifies the parent dataset name. Default is ADSL for CDISC data. If provided and exists, enables additional analysis "by subject". For non-CDISC data, this parameter can be ignored.

ggtheme

(character) optional, specifies the default ggplot2 theme for plots. Defaults to classic.

ggplot2_args

(ggplot2_args) optional, object created by teal.widgets::ggplot2_args() with settings for all the plots or named list of ggplot2_args objects for plot-specific settings. The argument is merged with options variable teal.ggplot2_args and 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 like shiny::helpText() are useful.

Value

Object of class teal_module to be used in teal applications.

Examples in Shinylive

example-1

Open in Shinylive

example-2

Open in Shinylive

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"]])
})
datanames(data) <- c("iris", "mtcars")

app <- init(
  data = data,
  modules = modules(
    tm_missing_data()
  )
)
#> Initializing tm_missing_data
#> Warning: 'package:rlang' may not be available when loading
#> Initializing reporter_previewer_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()
  )
)
#> Initializing tm_missing_data
#> Initializing reporter_previewer_module
if (interactive()) {
  shinyApp(app$ui, app$server)
}