Unstack a column from a data frame and include additional variables.
Unstack(
data,
mainVar = 1,
stackVar = (1:NCOL(data))[-mainVar],
extraVar = integer(0),
blockVar = integer(0),
sep = "_",
returnRowData = TRUE,
sorted = FALSE
)
When returnRowData=TRUE output is list of two elements.
Unstacked data
A separate data frame with one row for each unstack grouping composed of the stackVar variables
A data frame
Index of the variable to be unstacked
Index of variables defining the unstack grouping
Indices of within-replicated variables to be added to the rowData output
Indices of between-replicated variables to be added to the data output
A character string to separate when creating variable names
When FALSE output is no list, but only data
When TRUE the created variables is in sorted order. Otherwise input order is used.
Øyvind Langsrud
Stack
(examples)