dot-reshape_gather: A cross between 'gather' of package 'dplyr' and 'reshape'

.reshape_gatherR Documentation

A cross between gather of package dplyr and reshape

Description

This function is like gather and reshape(direction="long"). Like gather, it outputs names of variables that are gathered (ie turned from wide to long format). (reshape outputs a numeric variable for assumed discrete time.) In addition to variable name and value, it outputs (like reshape) a third variable retaining the wide format row information. reshape names this variable id; the current function names the variable wide.row.

Usage

.reshape_gather(data, columns, key, value, wide.row = TRUE)

Arguments

data

A data frame

columns

Columns to be gathered

key

New variable to store names of columns being gathered

value

New variable to contain values of columns being gathered

wide.row

Whether to include a variable named wide.row containing the row numbers from the original wide data. Defaults to TRUE.

Value

A data frame with the two new variables named in arguments key and value, plus a third new variable named wide.row. The remaining variables of the input dataset are carried over.


trangnguyen74/mediationClarity documentation built on May 4, 2023, 6:22 a.m.