Skip to contents

Subtracts the mean from a numeric vector, returning a vector (not a 1D matrix).

Usage

center(x, na.rm = TRUE)

Arguments

x

Numeric vector.

na.rm

Logical. Remove missing values when computing the mean (default `TRUE`).

Value

Numeric vector centered at zero.

Examples

center(c(10, 20, 30))
#> [1] -10   0  10