Learn R Programming

QuantPsyc (version 1.5)

meanCenter: Mean Center Variables

Description

This simple function subtracts the mean from a variable rendering mean-centered variables.

Usage

meanCenter(x)

Arguments

x
variable or column of data to be centered

Value

a numeric; mean centered 'x'

Details

This is particularly useful in lm() with higher order terms as in moderation.

Examples

Run this code
data(USJudgeRatings)
usCONT <- meanCenter(USJudgeRatings$CONT)
summary(usCONT)

Run the code above in your browser using DataLab