Dear UseRs,
MY PROBLEM IS A SMALL PIECE OF A REAL BIG AND A COMPLICATED PROBLEM. IF I DELIBERATE IN A VERY SIMPLE WAY THEN ALL I 
WANT IS TO PUT ALL THE POSSIBLE COMBINATIONS OF 75 DISTANCE MATRICES (BY TAKING 4 MATRICES, MORE COMMONLY 75C4), in the following equation.


t<-as.matrix((MAT1)^2+(MAT2)^2+(MAT3)^2+(MAT4)^2+,upper=T,diag=T))

Then "1215450" values of "t"(one for each combination) should one by one be inculcated in the following loop(to calculate the "o" value) and in the end want those 10 combinations of distance matrices which have lowest "o" values.

e <- vector("list", 124)

w<-sqrt(t)

mat1<-w

for (i in 1:124){

r<-matrix(sort(mat1[i,],index.return=TRUE)$ix,ncol=1)

u<-r[c(2,3,4,5,6),1]

mata<-m[,c(u)]				##(shifted)

amata<-apply(mata,1,mean)

amata<-data.frame(amata)

aavg<-as.matrix(amata, ncol=1)

b<-aavg

e[[i]]<-print(sum(abs(b-m[,i])))

}

x<-do.call(rbind,e)

Y<-x

z <- apply(Y,2,sd)

o<-mean(Y)

Does my question make any scene?
Thanks in advance
Elisa 		 	   		  
	[[alternative HTML version deleted]]

