R scale(): Scaling and Centering of Matrix-like Objects
The scale() function in R centers (subtracting the mean) and/or scales (dividing by the standard deviation) the columns of a numeric matrix or data frame. It transforms data to have a mean of 0 and a standard deviation of 1 by default, which is equivalent to computing z-scores. vec <- c(1, 2, 3, 4, 5, … Read more