reshape_spread: Reshape dataframe from long to wide

View source: R/reshape_spread.R

reshape_spreadR Documentation

Reshape dataframe from long to wide

Description

This function is an extension of the 'tidyr::spread()' function It can 'tidyr::spread()' on multiple keys and values.

Usage

reshape_spread(
  x,
  variables = "",
  values = c(),
  id = "",
  colname.order = "variable_value",
  variables_combine.sep = "_",
  fill = NA
)

Arguments

x

dataframe

variables

The variable used for spreading (The variables/conditions that values are grouped within)

values

A vector of columns that contain the values

id

What column is not being reorganized and needs to be preserved. Usually "Subject"

colname.order

The variable/value order to use when naming new columns. "variable_value" or "value_variable"

variables_combine.sep

if using more than one variables column then specifiy how values should be seperated when combined

fill

Passed to spread() fill parameter


dr-JT/datawrangling documentation built on June 25, 2022, 7:47 p.m.