center {jtools} | R Documentation |
Mean-center vectors, data frames, and survey designs
Description
This function is a wrapper around gscale()
that is configured
to mean-center variables without affecting the scaling of those variables.
Usage
center(
data = NULL,
vars = NULL,
binary.inputs = "center",
binary.factors = FALSE,
weights = NULL
)
Arguments
data |
A data frame or survey design. Only needed if you would like to
rescale multiple variables at once. If |
vars |
If |
binary.inputs |
Options for binary variables. Default is |
binary.factors |
Coerce two-level factors to numeric and apply scaling functions to them? Default is FALSE. |
weights |
A vector of weights equal in length to |
Details
Some more information can be found in the documentation for
gscale()
Value
A transformed version of the data
argument.
See Also
Other standardization:
center_mod()
,
gscale()
,
scale_mod()
,
standardize()
Examples
# Standardize just the "qsec" variable in mtcars
standardize(mtcars, vars = "qsec")