x <- c(3, 1, 4, 1, 5)
# stack x as rows
rowCopy(x, 4)
# stack x as columns
colCopy(x, 4)
# with custom dimension names
dnames <- list(rows = c("r1", "r2", "r3"), cols = c("c1", "c2", "c3", "c4", "c5"))
rowCopy(x, 3, dnames)
Run the code above in your browser using DataLab