[R] Sum results in a matrix

RMSOPS ricardosousa2000 at clix.pt
Wed Mar 14 10:28:22 CET 2012


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.



More information about the R-help mailing list