adjust_matrix: Remove rows with low variance and impute missing values

View source: R/utils.R

adjust_matrixR Documentation

Remove rows with low variance and impute missing values

Description

Remove rows with low variance and impute missing values

Usage

adjust_matrix(m, sd_quantile = 0.05, max_na = 0.25, verbose = TRUE)

Arguments

m

A numeric matrix.

sd_quantile

Cutoff of the quantile of standard deviation. Rows with standard deviation less than it are removed.

max_na

Maximum NA fraction in each row. Rows with NA fraction larger than it are removed.

verbose

Whether to print messages.

Details

The function uses impute.knn to impute missing values, then uses adjust_outlier to adjust outliers and removes rows with low standard deviations.

Value

A numeric matrix.

Author(s)

Zuguang Gu <z.gu@dkfz.de>

Examples

set.seed(123)
m = matrix(rnorm(100), nrow = 10)
m[sample(length(m), 5)] = NA
m[1, ] = 0
m
m2 = adjust_matrix(m)
m2

jokergoo/cola documentation built on Feb. 29, 2024, 1:41 a.m.