Skip to contents

Computes summaries of observations grouped by design variables.

Usage

# S3 method for class 'multiframe'
summarize_by(x, ..., sfun = colMeans, extract_data = FALSE)

Arguments

x

A multiframe object

...

Unquoted names of variables to group by

sfun

Summary function to apply (default is colMeans)

extract_data

Logical; if TRUE, returns just the summarized data

Value

A tibble containing summarized data for each group

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)

# Get means by condition
means_by_cond <- summarize_by(mf, condition)