fscale {lineup}R Documentation

Standardize the columns of a matrix

Description

Standardize each column in a matrix, so that the columns have mean 0 and SD 1.

Usage

fscale(x)

Arguments

x

A numeric matrix.

Details

Missing values (NA) are ignored and left as is.

If there is just 1 non-missing value in a column, it is left as is.

This function uses a one-pass algorithm to calculate the mean and SD, which is fast but can show a bit of round-off error.

Value

A matrix of the same form as the input, but with columns transformed to have mean 0 and SD 1.

Author(s)

Karl W Broman, broman@wisc.edu

See Also

base::scale()

Examples


x <- matrix(1:10, ncol=2)
y <- fscale(x)


[Package lineup version 0.44 Index]