isolate {bmlm} | R Documentation |
Create isolated within- (and optionally between-) person variables.
Description
Creates variables that represent pure within- and between-person predictors.
Usage
isolate(d = NULL, by = NULL, value = NULL, z = FALSE, which = "within")
Arguments
d |
A |
by |
A vector of values in |
value |
Names of columns in |
z |
Should the created values be standardized (defaults to FALSE). |
which |
Which component to return. "within" (default) returns within-person deviations only; "between" returns between-person means only; "both" returns both. |
Value
A data.frame
with additional columns for the within- and
between-person variables. The new columns are labelled _cw for
centered-within and _cb for centered-between.
Author(s)
Matti Vuorre mv2521@columbia.edu
Examples
# Create within-person deviations of work stressors in BLch9.
data(BLch9)
BLch9 <- isolate(BLch9, by = "id", value = "fwkstrs")
head(BLch9) # Now has new column for within-person work stressors.
[Package bmlm version 1.3.15 Index]