[R] generate combination set

Adrian Dusa dusa.adrian at gmail.com
Thu Nov 15 23:23:23 CET 2007


On Thursday 15 November 2007, Bill.Venables at csiro.au wrote:
> Actually, (now that I know about combn), a better way is
>
> t(matrix(set[combn(7,2)], nrow = 2))

Indeed, or to avoid transposing:

matrix(set[combn(7,2)], ncol = 2, byrow=T)

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