Re: [R] Combination that adds a value

2011-03-22 Thread Julio Rojas
Thx Petr. It worked likea charm. Regards. __ 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, re

Re: [R] Combination that adds a value

2011-03-21 Thread Petr Savicky
On Mon, Mar 21, 2011 at 04:08:50AM -0700, Julio Rojas wrote: > Dear all, I have three vectors "x<-1:n", "y<-1:m" and "z<-2:(n+m)". I need to > find all combinations of "x" and "y" that add up a given value of "z", e.g., > for "z==3" the combinations will be "list(c(1,2),c(2,1))". Dear Julio: T

[R] Combination that adds a value

2011-03-21 Thread Julio Rojas
Dear all, I have three vectors "x<-1:n", "y<-1:m" and "z<-2:(n+m)". I need to find all combinations of "x" and "y" that add up a given value of "z", e.g., for "z==3" the combinations will be "list(c(1,2),c(2,1))". Thanks in advance for your help.