[R] Combination
Dimitris Rizopoulos
d.rizopoulos at erasmusmc.nl
Tue Feb 17 13:57:35 CET 2009
Eik Vettorazzi wrote:
> Hi Dani,
> see ?combn .
>
> combn(1:50,2)
> gives you all combinations as matrix.
> you can do sth like
>
> apply(combn(1:50,2),2, paste, sep="", collapse="")
note that you could simplify the above by
combn(50, 2, paste, collapse = "")
Best,
Dimitris
> to get concatenated results.
>
> hth.
>
> Dani Valverde schrieb:
>> Hello,
>> I have a sequence of numbers:
>> seq(1:50)
>> and I would like to have all the possible combinations with this
>> numbers without repeating any combination:
>> 11, 12, 13, ... ,22,23,24,...
>> How can I do it?
>> Best,
>>
>> Dani
>>
>
--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus Medical Center
Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014
More information about the R-help
mailing list