View source: R/bruceR-stats_4_regress.R
grand_mean_center | R Documentation |
Compute grand-mean centered variables. Usually used for GLM interaction-term predictors and HLM level-2 predictors.
grand_mean_center(data, vars = names(data), std = FALSE, add.suffix = "")
data |
Data object. |
vars |
Variable(s) to be centered. |
std |
Standardized or not. Defaults to |
add.suffix |
The suffix of the centered variable(s).
Defaults to |
A new data object containing the centered variable(s).
group_mean_center
d = data.table(a=1:5, b=6:10)
d.c = grand_mean_center(d, "a")
d.c
d.c = grand_mean_center(d, c("a", "b"), add.suffix="_center")
d.c
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.