Re: [R] Composing two n-dimensional arrays into one n+1-dimensional array

2011-06-13 Thread Bert Gunter
Strangely enough, abind() in the abind package !! -- Bert ("all edge cases" is too vague to guess whether abind meets your criteria) On Mon, Jun 13, 2011 at 2:34 PM, Stavros Macrakis wrote: > If I have 2 n-dimensional arrays, how do I compose them into a n+1-dimension > array? > > Is there a st

[R] Composing two n-dimensional arrays into one n+1-dimensional array

2011-06-13 Thread Stavros Macrakis
If I have 2 n-dimensional arrays, how do I compose them into a n+1-dimension array? Is there a standard R function that's something like the following, but that gives clean errors, handles all the edge cases, etc. abind <- function(a,b) structure( c(a,b), dim = c(dim(a), 2) ) m1 <- array(1:6,c(