abind: Combine Multidimensional Arrays

> library(abind)

バージョン: 1.4.3


関数名 概略
abind Combine multi-dimensional arrays
acorn Return a corner of an array object (like head)
adrop Drop dimensions of an array object
afill Fill an array with subarrays
asub Arbitrary subsetting of array-like objects at specified indices

abind

> x <- matrix(1:12, 3, 4)
> y <- x + 100
> abind(x, y, along = 0) %>% dim()
[1] 2 3 4

acorn

> x <- array(1:24,
+            dim = c(4, 3, 2),
+            dimnames = rev(list(letters[1:2], LETTERS[1:3], letters[23:26])))
> acorn(x)
, , a

  A B  C
w 1 5  9
x 2 6 10
y 3 7 11
z 4 8 12

adrop

> x <- array(1:24,
+            dim = c(4, 3, 2),
+            dimnames = rev(list(letters[1:2], LETTERS[1:3], letters[23:26])))adrop(x[1, , , drop = FALSE], drop = 1)
Error: <text>:3:77: unexpected symbol
2:            dim = c(4, 3, 2),
3:            dimnames = rev(list(letters[1:2], LETTERS[1:3], letters[23:26])))adrop
                                                                               ^

asub

> x <- array(1:24,
+            dim = c(4, 3, 2),
+            dimnames = rev(list(letters[1:2], LETTERS[1:3], letters[23:26])))
> asub(x, 1, 1, drop=FALSE)
, , a

  A B C
w 1 5 9

, , b

   A  B  C
w 13 17 21