[R] Vectorized version of colMeans/rowMeans for higher dimension arrays?

2013-08-29 Thread Jonathan Greenberg
For matrices, colMeans/rowMeans are quick, vectorized functions. But say I have a higher dimensional array: moo - array(runif(400*9*3),dim=c(400,9,3)) And I want to get the mean along the 2nd dimension. I can, of course, use apply: moo1 - apply(moo,c(1,3),mean) But this is not a vectorized

Re: [R] Vectorized version of colMeans/rowMeans for higher dimension arrays?

2013-08-29 Thread arun
] Vectorized version of colMeans/rowMeans for higher dimension arrays? For matrices, colMeans/rowMeans are quick, vectorized functions.  But say I have a higher dimensional array: moo - array(runif(400*9*3),dim=c(400,9,3)) And I want to get the mean along the 2nd dimension.  I can, of course, use