Standardizes a numeric vector by centering it to have a mean of 0
and scaling it to have a standard deviation of 1.
Usage
norm_zscore(x, na.rm = TRUE)
Value
A numeric vector.
If the input vector has zero variance (all values are identical),
the function returns a centered vector (all zeros) and issues a warning.
Arguments
x
A numeric vector.
na.rm
Logical. Should NA values be removed during mean/sd calculation?
Default is TRUE.
Details
Formula: \(z = \frac{x - \mu}{\sigma}\)
References
Han, J., Kamber, M., & Pei, J. (2011). Data mining: concepts and techniques (3rd ed.). Morgan Kaufmann.