merged.stack {splitstackshape} | R Documentation |
Take a List of Stacked data.tables and Merge Them
Description
A wrapper around the Stacked
function to
merge
the resulting list
into a
single data.table
.
Usage
merged.stack(data, id.vars = NULL, var.stubs, sep, keep.all = TRUE,
...)
Arguments
data |
The input |
id.vars |
The columns to be used as "ID" variables. Defaults to |
var.stubs |
The prefixes of the variable groups. |
sep |
The character that separates the "variable name" from the "times"
in the source |
keep.all |
Logical. Should all the variables in the source
|
... |
Other arguments to be passed on to |
Value
A merged data.table
.
Note
The keyed
argument to Stacked
has been hard-
coded to TRUE
to make merge
work.
Author(s)
Ananda Mahto
See Also
Examples
set.seed(1)
mydf <- data.frame(id_1 = 1:6, id_2 = c("A", "B"),
varA.1 = sample(letters, 6),
varA.2 = sample(letters, 6),
varA.3 = sample(letters, 6),
varB.2 = sample(10, 6),
varB.3 = sample(10, 6),
varC.3 = rnorm(6))
mydf
merged.stack(mydf, var.stubs = c("varA", "varB", "varC"), sep = ".")