| rescale | R Documentation |
Rescale a variable to either z-scores with a mean of 0 and standard deviation of 1, normalized with a minimum of 0 and a maximum of 1, or to a variable computed like a z-score except use the median in place of the mean and the IQR in place of the standard deviation.
rescale(x, data=d, kind="z", digits_d=3)
x |
Variable to rescale. |
data |
Data frame that contains |
kind |
Type of rescaling. |
digits_d |
Number of significant digits. |
The default rescaling is standardization to z-scores, explicit with kind set to "z", or just centering about the mean with "center". For the min-max normalization to a range from 0 to 1, set kind to "0to1". For the robust equivalent of standardization, set kind to "robust".
If x is a vector in the global environment, then set data to NULL.
The rescaled data.
David W. Gerbing (Portland State University; gerbing@pdx.edu)
scale.
# z-score for m01
d <- Read("Employee")
d[, .("Salary")]
x <- rescale(Salary)
x
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.