Learn R Programming

textir (version 1.8-6)

normalize: Normalize

Description

Normalize matrix columns.

Usage

normalize(x, m=NULL, s=NULL, undo=FALSE)

Arguments

x
A matrix.
m
Optional column shifts.
s
Optional column scalings.
undo
If undo=TRUE this will undo a previous normalization. Otherwise, just normalize.

Value

  • Under default, a matrix with mean-zero and variance-one columns. If shift and scale are specified, a matrix with columns shifted by -m and divided by s. If undo=TRUE, and shift and scale are specified, an un-normalized matrix with column means m and standard deviations s. In the special case where x is a simple_triplet_matrix and m=0, columns are scaled by s but left unshifted and the function returns a simple_triplet_matrix.

See Also

freq, corr, sdev, pls

Examples

Run this code
normalize( matrix(1:9, ncol=3) )

Run the code above in your browser using DataLab