[R] Sum results in a matrix
RMSOPS
ricardosousa2000 at clix.pt
Tue Mar 13 13:15:15 CET 2012
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.
More information about the R-help
mailing list