center | R Documentation |
Function to perform mean-centering or median-centering on a numeric matrix or data frame.
center(x, method = "mean", drop.na = FALSE)
x |
A numeric matrix or data frame. |
method |
A character string specifying the centering method, either "mean" or "median". |
drop.na |
A logical value indicating whether to remove missing values (NA) before centering. |
Mean-centering calculates the mean of each column and subtracts this from the column. Median-centering is very similar to mean-centering except that the reference point is the median of each column rather than the mean.
A data frame with the same dimensions as the input, but with columns centered according to the specified method.
Christian L. Goueguel
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.