| pmean | R Documentation |
This function allows you calculate person-level means. This will create a level-2 variable that can be used in tandem with person-centered means. This is useful if you are interested in both the within-person and between-person effects.
pmean(ID, var)
ID |
name of ID variable |
var |
name of variable to be centered |
A column in your dataframe (with person-level means)
df <- data.frame(ID = c(1, 1, 2, 2), var = c(1, 3, 5, 9))
df$personMEAN <- pmean(df$ID, df$var)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.