isolate: Create isolated within- (and optionally between-) person...

Description Usage Arguments Value Author(s) Examples

View source: R/utils.R

Description

Creates variables that represent pure within- and between-person predictors.

Usage

1
2
isolate(d = NULL, by = NULL, value = NULL, z = FALSE,
  which = "within")

Arguments

d

A data.frame.

by

A vector of values in d by which the data is clustered. i.e. a vector of unique participant IDs.

value

Names of columns in d to isolate. Multiple values can be given by value = c("var1", "var2", "var3")

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

1
2
3
4
# 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.

bmlm documentation built on June 23, 2017, 5:03 p.m.