Scale: Scale a matrix-like object

Description Usage Arguments Details Value Author(s) Examples

Description

Scales the columns of a numeric matrix.

Usage

1
Scale(X, type = c("standardize", "normalize", "none"))

Arguments

X

A numeric matrix.

type

The scaling type. See details.

Details

This function is similar to scale in base package, but it can also normalize the columns of a matrix. Suppose x is one of the columns in matrix X. The "standardize" is defined as

standardize = (x - mean(x))/sd(x)

and the "normalize" is defined as

normalize = (x - min(x))/(max(x) - min(x)).

The "none" is just to keep the original values. It is designed for the grpss function in purpose.

Value

A scaled numeric matrix.

Author(s)

Debin Qiu, Jeongyoun Ahn

Examples

1
2
3
4
x <- matrix(1:18, ncol = 3)
Scale(x)  # standardization
Scale(x, type = "normalize")  # normalization
Scale(x, type = "none")  # do nothing

debinqiu/grpss documentation built on May 15, 2019, 1:54 a.m.