scale_matrix: Scale and Manipulate a Matrix

View source: R/scale_matrix.R

scale_matrixR Documentation

Scale and Manipulate a Matrix

Description

Scales a gene expression matrix, optionally applies logarithmic transformation, and performs feature manipulation to remove problematic variables (e.g., genes with zero variance or missing values).

Usage

scale_matrix(matrix, log2matrix = TRUE, manipulate = TRUE)

Arguments

matrix

Numeric matrix with genes as rows and samples as columns.

log2matrix

Logical indicating whether to apply log2 transformation using [log2eset()]. Default is 'TRUE'.

manipulate

Logical indicating whether to perform feature manipulation to remove problematic features. Default is 'TRUE'.

Value

A scaled matrix (genes as rows, samples as columns).

Author(s)

Dongqiang Zeng

Examples

set.seed(123)
test_matrix <- matrix(
  rlnorm(100),
  ncol = 5,
  dimnames = list(paste0("Gene", 1:20), paste0("Sample", 1:5))
)
eset2 <- scale_matrix(test_matrix, log2matrix = FALSE, manipulate = TRUE)
head(eset2)

IOBR documentation built on May 30, 2026, 5:07 p.m.