Hello, Given the matrices LSPs and services, need to generate the matrix (mtraffic) as follows:
1. Browse all lines of LSPs 2. Collect the value of bw (matrix services) in accordance with id2 3. Sum bw in mtraffic (line = source) (column = destiny) Thanks! Romildo Martins ********************** example01 ********************** > lsps id source destiny id2 caminho order 1 1 4 2 5 0 0 2 2 6 10 6 0 0 3 3 2 6 6 0 0 4 4 2 6 8 0 0 > services id2 bw prio pen fator order 1 1 128 5 32 0.25 0 2 2 64 5 16 0.25 0 3 3 64 5 64 1.00 0 4 4 16 5 16 1.00 0 5 5 32 1 192 6.00 0 6 6 64 1 512 8.00 0 7 7 512 3 128 0.25 0 8 8 32 7 32 1.00 0 > mtraffic 2 4 6 10 2 0 0 96 0 4 32 0 0 0 6 0 0 0 64 10 0 0 0 0 *************** example02 *************** > lsps id source destiny id2 caminho order 1 1 2 4 7 0 0 2 2 6 10 4 0 0 3 3 6 4 5 0 0 4 4 6 4 8 0 0 > services id2 bw prio pen fator order 1 1 128 5 32 0.25 0 2 2 64 5 16 0.25 0 3 3 64 5 64 1.00 0 4 4 16 5 16 1.00 0 5 5 32 1 192 6.00 0 6 6 64 1 512 8.00 0 7 7 512 3 128 0.25 0 8 8 32 7 32 1.00 0 > mtraffic 2 4 6 10 2 0 512 0 0 4 0 0 0 0 6 0 64 0 16 10 0 0 0 0 ______________________________________________ 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.