abind {garray} | R Documentation |
Combine generalized arrays
Description
Combine generalized arrays, similar to the manner cbind and rbind work. Put a sequence of generalized arrays and get a single generalized array of the same or one more margins.
Usage
abind(..., margins = character(), along = character())
Arguments
... |
arrays, or a list of several arrays. Margins of these arrays should be the same. |
margins |
Resulting margins. If includes a totally new margin (not
used by any arrays in |
along |
The dimension along which to bind the arrays.
The arrays may have different lengths along that dimension,
and are bind along it, with addition subdimension '*.bind.from'
indicating the composition
of the |
Details
Combine sdim correctly. Saving or dropping of subdimensions follow a few rules: subdimensions of the margin with bound along are dropped; of the other margins are save unless the names of subdimensions are the same; subdimensions of the same names are dropped except the first one.
Examples
a <- garray(1:24, c(4,6),
dimnames=list(X=1:4, Y=letters[1:6]),
sdim=list(XX=c(x1=3,x2=1), YY=c(y1=1,y2=2)))
b <- garray(1:6/10,6,dimnames=list(Y=letters[1:6]))
ab <- abind(a=a, b=b, along="X")
#abind(a, b, margins=c("X","Y")) # Error
ab2 <- abind(a=a, b=b, margins=c("X","Y"), along="X")
aa <- abind(a=a, a=a, along="Z")
ab3 <- abind(a, b, along="X")