Re: [R] Pairwise combination

2010-05-11 Thread chen jia
Thanks, everyone. combn function works pretty well for me. Best, Jia On Tue, May 11, 2010 at 5:12 PM, Henrique Dallazuanna wrote: > Or: > > combn(1:4, 2, paste, collapse = ' and ') > > On Tue, May 11, 2010 at 5:54 PM, Ista Zahn wrote: >> >> On Tuesday 11 May 2010 4:27:01 pm David Winsemius wro

Re: [R] Pairwise combination

2010-05-11 Thread Henrique Dallazuanna
Or: combn(1:4, 2, paste, collapse = ' and ') On Tue, May 11, 2010 at 5:54 PM, Ista Zahn wrote: > On Tuesday 11 May 2010 4:27:01 pm David Winsemius wrote: > > On May 11, 2010, at 1:45 PM, chen jia wrote: > > > Hi there, > > > > > > I am looking for a function that takes a vector as input and gen

Re: [R] Pairwise combination

2010-05-11 Thread David Winsemius
On May 11, 2010, at 4:54 PM, Ista Zahn wrote: On Tuesday 11 May 2010 4:27:01 pm David Winsemius wrote: On May 11, 2010, at 1:45 PM, chen jia wrote: Hi there, I am looking for a function that takes a vector as input and generates all pair wise combination of the elements of the input vecto

Re: [R] Pairwise combination

2010-05-11 Thread Ista Zahn
On Tuesday 11 May 2010 4:27:01 pm David Winsemius wrote: > On May 11, 2010, at 1:45 PM, chen jia wrote: > > Hi there, > > > > I am looking for a function that takes a vector as input and generates > > all pair wise combination of the elements of the input vector. > > ?combn > > > For example, th

Re: [R] Pairwise combination

2010-05-11 Thread Ista Zahn
combn(1:4, 2) will do it. -Ista On Tuesday 11 May 2010 1:45:14 pm chen jia wrote: > Hi there, > > I am looking for a function that takes a vector as input and generates > all pair wise combination of the elements of the input vector. > > For example, the input vector is c(1,2,3,4). The output v

Re: [R] Pairwise combination

2010-05-11 Thread David Winsemius
On May 11, 2010, at 1:45 PM, chen jia wrote: Hi there, I am looking for a function that takes a vector as input and generates all pair wise combination of the elements of the input vector. ?combn For example, the input vector is c(1,2,3,4). The output vector is c(1 and 2, 1 and 3, 1 and 4

Re: [R] Pairwise combination

2010-05-11 Thread Henrique Dallazuanna
try this: combn(c(1,2,3,4), 2) On Tue, May 11, 2010 at 2:45 PM, chen jia wrote: > Hi there, > > I am looking for a function that takes a vector as input and generates > all pair wise combination of the elements of the input vector. > > For example, the input vector is c(1,2,3,4). The output ve

[R] Pairwise combination

2010-05-11 Thread chen jia
Hi there, I am looking for a function that takes a vector as input and generates all pair wise combination of the elements of the input vector. For example, the input vector is c(1,2,3,4). The output vector is c(1 and 2, 1 and 3, 1 and 4, 2 and 3, 2 and 4, 3 and 4). The representation here is gen