Learn R Programming

sfsmisc (version 1.1-19)

col01scale: Matrix Scaling Utilities

Description

col01scale and colcenter (re)scale the columns of a matrix. These are simple one-line utilities, mainly with a didactical purpose.

Usage

colcenter (mat)
col01scale(mat, scale.func = function(x) diff(range(x)), location.func = mean)

Value

a matrix with the same attributes as the input mat.

Arguments

mat

numeric matrix, to rescaled.

scale.func, location.func

two functions mapping a numeric vector to a single number.

Author

Martin Maechler

See Also

The standard R function scale().

Examples

Run this code
## See the simple function definitions:

colcenter ## simply one line

col01scale# almost as simple

Run the code above in your browser using DataLab