一、scale函数
R语言base库中自带数据标准化接口scale函数,函数介绍如下
Usage
scale(x, center = TRUE, scale = TRUE)
Arguments
x: a numeric matrix(like object).
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.
Details
The value of center determines how column centering is performed. If center is a numeric vector with length equal to the number of columns of x, then each column of x has the corresponding value from center subtracted from it. If center is TRUE then centering is done by subtracting the column means (omitting NAs) of x from their corresponding columns, and if center is FALSE, no centering is done.
The value of scale determines how column scaling is performed (after centering). If