Skip to contents

Center a numeric vector to a target mean

Usage

morie_ml_center(x, center = mean(x, na.rm = TRUE))

Arguments

x

Numeric vector.

center

Target value subtracted (default the sample mean).

Value

Centered numeric vector, carrying a center attribute so the transform can be reversed.

Examples

morie_ml_center(1:5)
#> [1] -2 -1  0  1  2
#> attr(,"center")
#> [1] 3