splitAlongDim | R Documentation |
Split an array along its n-th dimension. The implementation was found here: https://stackoverflow.com/questions/20198751/three-dimensional-array-to-list
splitAlongDim(a, n)
a |
an array |
n |
number of the dimension along which to split the array |
array of one dimension less than a
# Define an array
A <- array(1:8, dim = c(2, 2, 2), dimnames = list(
paste0("x", 1:2), paste0("y", 1:2), paste0("z", 1:2)
))
splitAlongDim(A, 1)
splitAlongDim(A, 2)
splitAlongDim(A, 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.