to_wide: Convert Long Data to Wide Format

View source: R/data_utils.R

to_wideR Documentation

Convert Long Data to Wide Format

Description

A user-friendly wrapper around stats::reshape to convert data from long format back to wide format.

Usage

to_wide(data, within = "Condition", value = "Value", id = NULL)

Arguments

data

A data frame in long format.

within

The name of the column containing within-subjects factor levels (e.g., "Condition").

value

The name of the column containing measurement values (e.g., "Value"). Can be a character vector for multiple measurement columns.

id

The identifier columns (e.g., "Subject", "Group"). If NULL, inferred as all columns except within and value.

Value

A data frame in wide format.


BayesRTMB documentation built on Nov. 24, 2026, 9:06 a.m.