normalize {cwhmisc}R Documentation

Normalize vectors

Description

Normalize the columns of a matrix.

Usage

  normalize(x)

Arguments

x the matrix containing the vectors to be normalized as columns.

Value

The matrix containing the normalized vectors as columns. If you want to normalize the rows of a matrix, use t(normalize(t(x)))

Author(s)

Christian W. Hoffmann <c-w.hoffmann@sunrise.ch>
http://www.wsl.ch/personal_homepages/hoffmann/index_EN

Examples

  x <- matrix(rnorm(30),nrow=6)
  normalize(x)
  t(normalize(t(x)))  # normalize the *rows* of x

[Package cwhmisc version 2.0.1 Index]