View source: R/transformations.R
center_matrix | R Documentation |
Simple function to center data
center_matrix(mat, centers = NULL)
mat |
a transformed data matrix. |
centers |
a vector of centering values. Length must be equal to the
number of columns in |
Centering is done by means for continuous variables (i.e. more than 2 distinct values), and the minimum for binary variables.
It is assumed all categorical variables in the data are represented by binary dummy variables.
Transformed data matrix. Has an attribute scaled:center
that stores
values used for centering.
mat = matrix(1:100, nrow = 10)
center_matrix(mat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.