| center {quest} | R Documentation |
Centering and/or Standardizing a Numeric Vector
Description
center centers and/or standardized a numeric vector. It is an
alternative to scale.default that returns a numeric vector rather than
a numeric matrix.
Usage
center(x, center = TRUE, scale = FALSE)
Arguments
x |
numeric vector. |
center |
logical vector with length 1 specifying whether grand-mean centering should be done. |
scale |
logical vector with length 1 specifying whether grand-SD scaling should be done. |
Details
center first coerces x to a matrix in preparation for the call
to scale.default. If the coercion results in a non-numeric matrix
(e.g., x is a character vector or factor), then an error is returned.
Value
numeric vector of x centered and/or standardized with the same
names as x.
See Also
centers
center_by
centers_by
scale.default
Examples
center(x = mtcars$"disp")
center(x = mtcars$"disp", scale = TRUE)
center(x = mtcars$"disp", center = FALSE, scale = TRUE)
center(x = setNames(mtcars$"disp", nm = row.names(mtcars)))
[Package quest version 0.2.0 Index]