Learn R Programming

iNZightTools (version 1.13.0)

reshape_data: 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, col1, col2, cols, key, value, check)

Value

reshaped dataset

Arguments

.data

dataset

col1

column to spread out (for long to wide)

col2

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

cols

columns(s) to gather together (for wide to long)

key

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

value

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

check

check whether to use long to wide or wide to long

Author

Yiwen He