Standardizes a numeric vector by making its mean 0 and variance 1.

z(x, mu, sigma)

Arguments

x

Numeric vector.

mu

Single value. Population mean.

sigma

Single value. Population standard deviation.

Value

Returns a numeric vector of z-scores.

Examples

x <- rnorm(n = 10, mean = 100, sd = 15) z(x = x, mu = 100, sigma = 15)
#> [1] -1.400043517 0.255317055 -2.437263611 -0.005571287 0.621552721 #> [6] 1.148411606 -1.821817661 -0.247325302 -0.244199607 -0.282705449