powered by
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.
cosnormX(X, rows = TRUE)
Cosine-normalized X.
Numeric matrix or data.frame of any size.
If TRUE, the operation is done by row; otherwise, it is done by column. (Defaults: TRUE).
dat <- matrix(rnorm(50),ncol=5,nrow=10) cosnormX(dat)
Run the code above in your browser using DataLab