wide2long {Ymisc}R Documentation

Reshapes the data

Description

wide2long() function is data-reshaping function for wide format data. This function mainly targets the brain structure data that contains the data from the left and right hemispheres

Usage

wide2long(data, ID = "ID", separator = "_", hemisphere = "prefix", start, end)

Arguments

data

The wide format data.

ID

The column of identifiers.

separator

A character vector that separates characters in the variable names.

hemisphere

Whether a hemisphere indicator in the variable names is a prefix or suffix. At this point, only the "prefix" option is available.

start

The column that specifies the starting point of a set of variables to be reshaped

end

The column that specifies the endpoint of a set of variables to be reshaped

Value

The long format data

Examples


data(sample_data)

long<-wide2long(
data=sample_data,
ID="ID",
separator="_",
start="lh_Thalamus",
end="rh_AccumbensArea",
hemisphere="prefix"
)

[Package Ymisc version 0.1.0 Index]