powered by
This function standardized each column of a dataframe or matrix (-alike) to have \(mean = 0\) and \(sd = 1\).
zscore(X)
Dataframe or matrix (-alike) containing data.
The standardized dataframe.
# NOT RUN { X <- matrix(rnorm(100, 0.2, 0.3), nrow = 20) X_std <- zscore(X) print(apply(X_std, 2, mean)) print(apply(X_std, 2, sd)) # }
Run the code above in your browser using DataLab