Learn R Programming

kim (version 0.6.1)

mean_center: Mean center

Description

Mean-center a variable, i.e., subtract the mean of a numeric vector from each value in the numeric vector

Usage

mean_center(x)

Arguments

x

a numeric vector; though not thoroughly tested, the function can accept a matrix as an input.

Examples

Run this code
mean_center(1:5)
mean_center(1:6)
# if the input is a matrix
matrix(1:9, nrow = 3)
mean_center(matrix(1:9, nrow = 3))

Run the code above in your browser using DataLab