thank you It is working, a question in the wake of the array.
with the following code I am creating a data frame to store the data without repeating the code is working. The question is the best way to do this process in R tab<-NULL for(i in 1: nrow(res4)) { for(j in i:nrow(res4)) { #print(paste(i,"-",j,"-",res4[i,j])) temp<-data.frame(i,j,res4[i,j]) tab<-rbind(tab,temp) } } tab i j res4.i..j. 1 1 1 0 2 1 2 21 3 1 3 0 4 1 4 0 5 1 5 0 6 1 6 0 7 1 7 0 8 2 2 0 -- View this message in context: http://r.789695.n4.nabble.com/Sum-results-in-a-matrix-tp4468936p4471368.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.