Skip to contents

Splits a multiframe into groups based on one or more design variables. Optionally collapses the observations within each group into a single matrix.

Usage

# S3 method for class 'multiframe'
split(x, ..., collapse = FALSE)

Arguments

x

A multiframe object

...

Unquoted names of variables to split by

collapse

Logical; if TRUE, combines observations in each group into a matrix

Value

A nested tibble containing the split data

Examples

x <- matrix(1:40, 10, 4)
y <- data.frame(
  condition = rep(c("A", "B"), each=5),
  subject = rep(1:5, times=2)
)
mf <- multiframe(x, y)

# Split by condition
split_by_cond <- split(mf, condition)

# Split by condition and subject, collapsing observations
split_by_both <- split(mf, condition, subject, collapse=TRUE)