Learn R Programming

gamlr (version 0.1)

normalize: Normalize

Description

Normalize matrix columns.

Usage

normalize(x, m=NULL, s=sdev(x))

Arguments

x
A matrix.
m
Optional column shifts.
s
Column scaling factor (we divide by s).

Value

  • If x is a matrix, the default returns mean-zero and variance-one columns. If x is a simple_triplet_matrix, columns are scaled by sdev(x) but left unshifted; the function returns a simple_triplet_matrix. If shift and scale are specified AND x is a matrix, columns are shifted by -m and divided by s.

Examples

Run this code
x <- matrix(1:9, ncol=3)
normalize( x )
as.matrix(normalize(as.simple_triplet_matrix(x)))

Run the code above in your browser using DataLab