Skip to contents

Normalizes values to z-scores (standard deviations from mean).

Usage

normalize_zscore(x, center = NULL, scale = NULL, na.rm = TRUE)

Arguments

x

Numeric vector

center

Value to center around (default: mean of x)

scale

Scale factor (default: standard deviation of x)

na.rm

Logical; remove NA values when computing center/scale?

Value

Numeric vector of z-scores

Examples

x <- c(10, 20, 30, 40, 50)
normalize_zscore(x)
#> [1] -1.2649111 -0.6324555  0.0000000  0.6324555  1.2649111