Skip to contents

For data in wide format, the name of time varying columns follow the pattern var_time.

Usage

longToWide.ts(d, timevar, idCols = NULL)

wideToLong.ts(d, timevar, vars, idCols = NULL, regex_time = ".+")

wideTo3Darray.ts(d, vars, idCols = NULL)

longTo3Darray.ts(d, timevar, idCols = NULL)

Arguments

d

a data.frame or matrix.

timevar

column name for the time.

idCols

ids or no time varying columns. Works with column names and indexes.

vars

time varying variables in the long format (ie. without the _time part in wide format).

regex_time

a regular expression for the time part of the variable names for data in wide format.

Value

the same data in a wide [var_time columns], long [time + vars columns] or a 3D array [samples, time, vars] format.