Description Usage Arguments Value Examples
Function to mean center predictor variables.
1 | mean_center(x)
|
x |
A numeric vector. |
A numeric vector containing x minus the mean of x. Note that NA's are ignored.
1 2 3 4 5 6 7 8 9 10 | # load mtcars data
data(mtcars)
# Mean center a single numeric variable
(mtcars$c_mpg <- mean_center(mtcars$mpg))
# Mean center multiple numeric variables
centered <- do.call(cbind, lapply(mtcars[c("mpg", "hp")], mean_center))
colnames(centered) <- c("c_mpg", "c_hp")
mtcars2 <- cbind(mtcars, centered)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.