Re: [R] generate combination set

2007-11-16 Thread Peter Dalgaard
Adrian Dusa wrote: > On Thursday 15 November 2007, [EMAIL PROTECTED] 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 > > Or ev

Re: [R] generate combination set

2007-11-16 Thread Adrian Dusa
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

Re: [R] generate combination set

2007-11-16 Thread Adrian Dusa
On Friday 16 November 2007, Peter Dalgaard wrote: > [...] > > Or even (from someone who have known about combn for a while) > > > combn(LETTERS[1:7], 2, paste, collapse="") > > [1] "AB" "AC" "AD" "AE" "AF" "AG" "BC" "BD" "BE" "BF" "BG" "CD" "CE" > "CF" "CG" > [16] "DE" "DF" "DG" "EF" "EG" "FG" Ch

Re: [R] generate combination set

2007-11-15 Thread Adrian Dusa
quot;D" "F" > [18,] "D" "G" > [19,] "E" "F" > [20,] "E" "G" > [21,] "F" "G" > > > Bill Venables > CSIRO Laboratories > PO Box 120, Cleveland, 4163 > AUSTRALIA > Office Ph

Re: [R] generate combination set

2007-11-15 Thread Adrian Dusa
On Thursday 15 November 2007, [EMAIL PROTECTED] 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 Ma

Re: [R] generate combination set

2007-11-15 Thread Bill.Venables
-project.org Subject: Re: [R] generate combination set Using your "set", wouldn't it be simpler like this? t(apply(combn(7,2), 2, function(x) set[x])) Hth, Adrian On Thursday 15 November 2007, [EMAIL PROTECTED] wrote: > There are a number of packages that do this, but here is a sim

Re: [R] generate combination set

2007-11-15 Thread Charilaos Skiadas
"D" "E" >> [17,] "D" "F" >> [18,] "D" "G" >> [19,] "E" "F" >> [20,] "E" "G" >> [21,] "F" "G" >> >> >> Bill Venables >>

Re: [R] generate combination set

2007-11-15 Thread Bill.Venables
"G" [19,] "E" "F" [20,] "E" "G" [21,] "F" "G" Bill Venables CSIRO Laboratories PO Box 120, Cleveland, 4163 AUSTRALIA Office Phone (email preferred): +61 7 3826 7251 Fax (if absolutely necessary): +61 7 3826 7304 Mobile:

[R] generate combination set

2007-11-14 Thread aiminy
I have a set data={A,B,C,D,E,F,G} I want to choose 2 letter from 8 letters, i.e. generate the combination set for choose 2 letters from 8 letters. I want to get the liking: combination set={AB,AC,AD,} Does anyone konw how to do in R. thanks, Aimin ___