cosnormX {kerntools} | R 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)
[Package kerntools version 1.0.2 Index]