Re: [R] Combining elements of vectors

2009-06-08 Thread Marie Sivertsen
On Mon, Jun 8, 2009 at 3:04 PM, baptiste auguie wrote: > Marie Sivertsen wrote: > >> Dear list, >> >> I have a vector of elements which I want to combined each with each, but >> none with itself. For example, >> >> >> >>> v <- c("a", "b", "c") >>> >>> >> >> and I need a function 'combine' such tha

Re: [R] Combining elements of vectors

2009-06-08 Thread Marie Sivertsen
Thank you both Dimitiris and Jorge Ivan! I have just found it myself that 'combn' does what I need: > combn(v, 2, simplify=TRUE) is exactly what I need. Mvh., Marie On Mon, Jun 8, 2009 at 3:03 PM, Dimitris Rizopoulos < d.rizopou...@erasmusmc.nl> wrote: > one way is: > > combn(c("a", "b",

Re: [R] Combining elements of vectors

2009-06-08 Thread baptiste auguie
Marie Sivertsen wrote: Dear list, I have a vector of elements which I want to combined each with each, but none with itself. For example, v <- c("a", "b", "c") and I need a function 'combine' such that combine(v) [[1]] [1] "a" "b" [[2]] [1] "a" "b" [[3]] [1] "b" "c" I a

Re: [R] Combining elements of vectors

2009-06-08 Thread Dimitris Rizopoulos
one way is: combn(c("a", "b", "c"), 2) I hope it helps. Best, Dimitris Marie Sivertsen wrote: Dear list, I have a vector of elements which I want to combined each with each, but none with itself. For example, v <- c("a", "b", "c") and I need a function 'combine' such that combine(v)

Re: [R] Combining elements of vectors

2009-06-08 Thread Jorge Ivan Velez
Dear Marie, Try this: combn(v,2,list) HTH, Jorge On Mon, Jun 8, 2009 at 8:56 AM, Marie Sivertsen wrote: > Dear list, > > I have a vector of elements which I want to combined each with each, but > none with itself. For example, > > > v <- c("a", "b", "c") > > and I need a function 'combine' su

[R] Combining elements of vectors

2009-06-08 Thread Marie Sivertsen
Dear list, I have a vector of elements which I want to combined each with each, but none with itself. For example, > v <- c("a", "b", "c") and I need a function 'combine' such that > combine(v) [[1]] [1] "a" "b" [[2]] [1] "a" "b" [[3]] [1] "b" "c" I am not very interested in the orders of th