index1 <- as_index(matrix(1:6, 2))
index2 <- index1
time(index2) <- 4:6
stack(index1, index2)
# Unstack does the reverse
all.equal(
c(unstack(index1), unstack(index2)),
unstack(stack(index1, index2))
)
Run the code above in your browser using DataLab