Hello, With the following code get the results array res3<-table(df$v_source,df$v_destine)
1 2 3 4 5 6 7 1 0 10 0 0 0 0 0 2 11 0 0 0 0 0 0 3 0 0 18 15 0 0 0 4 0 0 15 11 0 0 0 5 0 0 0 0 1 0 0 6 0 0 0 0 0 1 0 7 0 0 0 0 0 0 18 my idea was to create a new table of results from res3 but making the sum of the results where the position of the origin and destination were reversed. for example [1,2]= 10 [2,1]=11 New Table Final. points result [1 and 2] 21 thanks -- View this message in context: http://r.789695.n4.nabble.com/Sum-results-in-a-matrix-tp4468936p4468936.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.