wide2long: Convert data from wide to long format

View source: R/wide2long.R

wide2longR Documentation

Convert data from wide to long format

Description

Convert data from wide to long format

Usage

wide2long(
  data,
  within_factors = c(),
  within_cols = c(),
  dv = "y",
  id = "id",
  sep = faux_options("sep")
)

Arguments

data

the tbl in wide format

within_factors

the names of the within factors

within_cols

the names (or indices) of the within-subject (value) columns

dv

the name of the dv column (defaults to "y")

id

the name of the ID column(s) if they don't exist, a new column will be made (defaults to ("id")

sep

separator for within-columns (to be used in strsplit, so can be regex), defaults to "_"

Value

a tbl in long format

Examples

wide2long(iris, c("Feature", "Measure"), 1:4, sep = "\\.")


faux documentation built on April 20, 2023, 9:13 a.m.