groupcenter: Group centering

Description Usage Arguments Value Author(s) Examples

View source: R/groupcenter.R

Description

Center a continuous variable under the levels of a categorical variable, typically a random factor. The function returns the values of x centered at the means of x under each level of the group variable.

Usage

1

Arguments

x

A vector with numerical values

group

A vector with categorical values

Value

A vector with group-centered x values.

Author(s)

Joost van de Weijer

Examples

1
2
dfr=data.frame(subject=c(1,1,1,2,2,2,3,3,3),dv=c(2,4,1, 6,1,2, 4,3,3))
groupcenter(dfr$dv,group=dfr$subject)

vdweijer/supply documentation built on June 28, 2021, 7:45 a.m.