Dear R users, BB1<-array(rep(0,14400),dim=c(16,5,12,15)) > > for (i in 2:13) { + BB1[,,(i-1),1]<-BB[,,i] + } > > > length<-rep(0,15) > CC<-array(rep(0,1200),dim=c(16,5,15)) > n<-12 > l<-0 > > fun1 <- function(x, y){ + all(sapply(seq_len(nrow(x)), function(i) + identical(x[i,], y[i,]) || identical(x[i,], -y[i,]))) + } > fun2 <- function(x, y){ + all(sapply(seq_len(ncol(x)), function(i) + identical(x[,i], y[,i]) || identical(x[,i], -y[,i]))) + } > > > for (j in 2:15) { + + l<-l+1 + length[l]<-n + + n<-0 + + for (i in 2:length[l]) { + if (fun1(BB1[,,1,(j-1)],BB1[,,i,(j-1)])==FALSE) { + + n<-n+1 + BB1[,,n,j]<-BB1[,,i,(j-1)] + CC[,,j]<-BB1[,,1,(j-1)] + + } + } + } Error in y[i, ] : incorrect number of dimensions
when i put in BB1 numbers where (j-1) is this work perfectly [[alternative HTML version deleted]]
______________________________________________ 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.