cosnormX: Cosine normalization of a matrix

View source: R/normalization.R

cosnormXR Documentation

Cosine normalization of a matrix

Description

Normalizes a numeric matrix dividing each row (if rows=TRUE) or column (if rows=FALSE) by their L2 norm. Thus, each row (or column) has unit norm.

Usage

cosnormX(X, rows = TRUE)

Arguments

X

Numeric matrix or data.frame of any size.

rows

If TRUE, the operation is done by row; otherwise, it is done by column. (Defaults: TRUE).

Value

Cosine-normalized X.

Examples

dat <- matrix(rnorm(50),ncol=5,nrow=10)
cosnormX(dat)

kerntools documentation built on April 3, 2025, 7:52 p.m.