Hi, I am trying to get different combinations of a vector of different size and find their sum. For example, if I have a vector (i,j) where i and j can be anything from 0 to 5, i get these combinations (0,0), (0,1), (1,0), (1,1), (2,0), ...... (5,5) and find sum of these as 0, 1, 1, 2, ..... , 10. I used outer functions to get this and it worked. What if I have a vector (i,j,k) where all i, j , and k can be anything from 0 to 5. I want to do the same thing here. Get all the combinations and sum them up. (0,0,0) (0,0,1), (0,1,0), (1,0,0), .... (5,5,5) How can I get these combinations and find their sums? Thank you very much in advance.
Uka [[alternative HTML version deleted]] ______________________________________________ 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.