reshape_data: Reshaping dataset from wide to long or from long to wide

View source: R/reshape_data.R

reshape_dataR Documentation

Reshaping dataset from wide to long or from long to wide

Description

Reshaping dataset from wide to long or from long to wide

Usage

reshape_data(
  data,
  data_to = c("long", "wide"),
  cols,
  names_to = "name",
  values_to = "value",
  names_from = "name",
  values_from = "value"
)

Arguments

data

a dataset to reshape

data_to

whether the target dataset is long or wide

cols

columns to gather together (for wide to long)

names_to

name for new column containing old names (for wide to long)

values_to

name for new column containing old values (for wide to long)

names_from

column to spread out (for long to wide)

values_from

values to be put in the spread columns (for long to wide)

Value

reshaped dataset

Author(s)

Zhaoming Su


iNZightVIT/iNZightTools documentation built on April 8, 2024, 10:25 a.m.