[R] generate combination set

Adrian Dusa dusa.adrian at gmail.com
Fri Nov 16 14:57:57 CET 2007


Hi Haris,

On Thursday 15 November 2007, Charilaos Skiadas wrote:
> I must be missing something. What's wrong with:
>
> combn(set, 2)
>
> or if we must t(combn(set,2)), optionally with a function argument in
> the combn call if something is to be done with the pairs?
>
> So if you really wanted the outputs to be "AB","AC" etc, you would do:
>
> combn(set,2, paste, collapse="")

Indeed, you got the right solution even from yesterday. I get my emails in a 
digest mode, so if you don't reply to all (CC all the others including the 
list) your solution doesn't arrive in my Inbox but until the next day.

Best,
Adrian

-- 
Adrian Dusa
Romanian Social Data Archive
1, Schitu Magureanu Bd
050025 Bucharest sector 5
Romania
Tel./Fax: +40 21 3126618 \
          +40 21 3120210 / int.101



More information about the R-help mailing list