scale {base} | R Documentation |
scale(x, center=TRUE, scale=TRUE)
x |
a numeric matrix. |
center |
either a logical value
or a numeric vector of length equal to the
number of columns of x . |
scale |
either a logical value
or a numeric vector of length equal to the
number of columns of x . |
Center and/or scale the columns of a numeric matrix.
The centered, scaled matrix.
sweep
which allows centering (and scaling) with
arbitrary statistics.
x <- matrix(1:10, nc=2) (centered.x <- scale(x, scale=FALSE)) cov(centered.scaled.x <- scale(x))# all 1