Explore missing data

library(REDCapDM) 
library(kableExtra)
library(knitr)
library(dplyr)
library(purrr)

The examples use covican, the dataset included in the package (described in vignette("REDCapDM")).

rd_missplot

The rd_missplot() function gives a visual summary of the missing values of the dataset. It needs the ggplot2 package.

By default (by = "vars"), it shows the percentage of missing values of each variable. In longitudinal projects, it is a heatmap with one row per event. When the event-form mapping is available, each variable is only evaluated in the events where its form is collected, and the other cells are left blank:

rd_missplot(covican)

With by = "record", the plot shows one row per record and one column per variable, with the missing values painted. In longitudinal projects there is one panel per event, each with the variables collected in that event. By default only the first event is plotted (with a warning), so use the events argument to choose others (events = "all" for every event). Records without data in an event are shown in grey. In this example we use the first 30 records, so that their identifiers can be read:

covican_30 <- covican
covican_30$data <- covican$data |> 
  dplyr::filter(record_id %in% unique(record_id)[1:30])

rd_missplot(covican_30, by = "record", events = "all", forms = c("vital_signs", "laboratory_findings"))

Other useful arguments:

Events with the same name (e.g. the same event in two arms) get their unique name in parentheses, so that they aren't merged, and so do the variables that share a label (with their variable name). The data can be grouped (e.g. with dplyr::group_by()): the plot is the same.



Try the REDCapDM package in your browser

Any scripts or data that you put into this service are public.

REDCapDM documentation built on Nov. 27, 2026, 9:06 a.m.