demean removes the mean or mean-centers a variable (excludes NA values)

demean(x)

Arguments

x

a vector of numbers

Value

A vector of mean-centered numbers (mean = 0)

Note

This function is just a wrapper for x - mean(x, na.rm = T)

Author

Hause Lin

Examples

demean(1:3)
#> [1] -1 0 1