powered by
InsertDim(var, posdim, lendim)
a <- array(rnorm(15), dim = c(3, 1, 5, 1)) print(dim(a)) print(dim(a[, , , ])) print(dim(InsertDim(InsertDim(a[, , , ], 2, 1), 4, 1)))
Run the code above in your browser using DataLab