Hi Alex,
Try:
set.seed(345)
results<- array(sample(-5:5,120,replace=TRUE),dim=c(10,3,4))
indx <- !!apply(results,1,sum)
library(plyr)
results2 <- laply(lapply(seq(dim(results)[1]),function(i) 
results[i,,])[indx],identity)
attr(results2,"dimnames") <- NULL
 dim(results2)
#[1] 9 3 4

A.K.



I have a 3D array with 13,000 11x8 matrices. 

dim(results
[1] 13000    11     8 

Some matrices in the array add up to 0. For example 

sum(results[1,,])==0
[1] TRUE 

I would like to remove these. How can I do this?

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to