z. | R Documentation |
Generic function that standardizes a vector, matrix or dataframe by user-defined parameters.
z.(x, center = NULL, factor = 1)
x |
a vector, matrix, or dataframe. |
center |
numeric. Value around which values in |
factor |
numeric. A scale multiplier (see details). |
For each item in x
, subtract value specified by center
and divide by scaling factor. The scaling factor is the standard deviation of x
times factor
. The default is z-score standardization (center around mean and divide by 1 standard deviation).
Jason Grafmiller
Gelman, A. & J. Hill. 2007. Data Analysis Using Regression and Multilevel/Hierarchical Models. New York: Cambridge University Press.
scale
, c.
x <- rnorm(50, mean = 10, sd = 5)
z.(x)
z.(x, factor = 2)
z.(x, center = 2, factor = 1.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.