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 the output items for
Dear Marie,
Try this:
combn(v,2,list)
HTH,
Jorge
On Mon, Jun 8, 2009 at 8:56 AM, Marie Sivertsen mariesiv...@gmail.comwrote:
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
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)
[[1]]
[1] a
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 am not very
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, c), 2)
On Mon, Jun 8, 2009 at 3:04 PM, baptiste auguie
baptiste.aug...@gmail.comwrote:
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
6 matches
Mail list logo