Skip to content

Calculate the "missingness" (NAs) of clinical meta data of an ADAT. For the S3 plotting method, see plot.Map().

Usage

calcMissingnessMap(data, include.pattern = ".", exclude.pattern = NULL)

# S3 method for missingness_map
print(x, ...)

Arguments

data

A data frame (or soma_adat) of only the meta data columns (i.e. no analytes).

include.pattern

Character (optional). A regular expression string used in a grep() call to include matching column names. Defaults to include all column names in the meta data (".").

exclude.pattern

Character (optional). A regular expression string used in a grep() call to exclude matching column names.

x

An object of class "missingness_map".

...

Arguments for S3 print methods.

Value

A list of class c("missingness_map", "Map") containing:

matrix

A boolean matrix of TRUE/FALSE whether each sample is in missingness according the the stated criteria.

names

A character vector containing the names of the meta data columns.

rows.by.freq

A logical indicating if the samples are ordered by missingness frequency. Currently always FALSE.

legend.sub

A character string containing the plot legend subtitle.

title

A character string containing the plot title.

x.lab

A character string containing the plot x-axis label.

Functions

  • print(missingness_map): There is a S3 print method for "missingness_map".

See also

Author

Stu Field

Examples

sample.adat <- SomaDataIO::example_data
meta <- sample.adat[, SomaDataIO::getMeta(sample.adat)]

# random assign NAs
cols <- rep(1:ncol(meta), each = 3)
rows <- as.integer(replicate(ncol(meta), sample(1:nrow(meta), 3)))
meta[cbind(rows, cols)] <- NA

mm <- calcMissingnessMap(meta)
class(mm)
#> [1] "missingness_map" "Map"             "list"           

# S3 print method
mm
#> ══ SomaLogic Missingness Map ═════════════════════════════════════════════
#>   Missingness Map dim       '192 x 34'
#>   Title                     'Meta Data Missingness Map'
#>   Class Table               NA
#>   Legend Sub-title          'MetaData'
#> ══════════════════════════════════════════════════════════════════════════