| 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, drop.na = deprecated())
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 ignore missing values (NA) when computing the column means or medians. Missing values are kept in the output. |
drop.na |
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 numeric matrix with the same dimensions as the input, with
columns centered according to the specified method. The column centers
are stored in the "center" attribute.
Christian L. Goueguel
data(forageLIBS)
spectra <- forageLIBS[-(1:14)] # the spectral channels
center(spectra)[1:3, 1:4]
center(spectra, method = "median")[1:3, 1:4]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.