centerESM: Center variables in ESM data

Description Usage Arguments Value Examples

View source: R/centerESM.R

Description

Group centering or grand-mean centering the specified variables and optionally add them to the data

Usage

1
centerESM(data, subjnr = NULL, addmeans = TRUE, varnames = NULL, center = NULL)

Arguments

data

data frame

subjnr

variable, indicating subjects

addmeans

logical indicating whether a vector of person means should be added to the data (works only if person centering is requested for that variable).

varnames

vector with the names of the variables which are centered.

center

vector of same length as varnames that indicates for each variable which centering must be, applied, either "person" or "grand_mean" or a number. If "person" or "grand_mean" is specified once (default), all variables are person or grand-mean centered, respectively. If center is NULL no variables are centered and a warning is issued.

Value

data frame with centered variables, and if requested, person means with suffix "_means".

Examples

1
2
3
4
5
data("news")
res <- centerESM(data = news, subjnr="subjnr",
       addmeans = TRUE, 
       varnames = c("Fearful", "Relaxed", "Anxious"), 
       center = c("person", "person", "person"))

PeterVerboon/lagnetw documentation built on Aug. 4, 2020, 5:16 p.m.