[R] A question to get all possible combinations

2010-12-22 Thread Ron Michael
Let say, I have a matrix with 8 rows and 6 columns:   df1  - matrix(NA, 8, 4)  df1       [,1] [,2] [,3] [,4]  [1,]   NA   NA   NA   NA  [2,]   NA   NA   NA   NA  [3,]   NA   NA   NA   NA  [4,]   NA   NA   NA   NA  [5,]   NA   NA   NA   NA  [6,]   NA   NA   NA   NA  [7,]   NA   NA   NA   NA 

Re: [R] A question to get all possible combinations

2010-12-22 Thread jim holtman
which 6 cells do you want? do you want one from each column? You could use expand.grid: x - expand.grid(1:8, 1:8, 1:8, 1:8, 1:8, 1:8) str(x) 'data.frame': 262144 obs. of 6 variables: $ Var1: int 1 2 3 4 5 6 7 8 1 2 ... $ Var2: int 1 1 1 1 1 1 1 1 2 2 ... $ Var3: int 1 1 1 1 1 1 1 1 1

Re: [R] A question to get all possible combinations

2010-12-22 Thread G. Jay Kerns
Dear Ron, On Wed, Dec 22, 2010 at 1:19 PM, Ron Michael ron_michae...@yahoo.com wrote: Let say, I have a matrix with 8 rows and 6 columns:  df1  - matrix(NA, 8, 4) df1      [,1] [,2] [,3] [,4] [1,]   NA   NA   NA   NA [2,]   NA   NA   NA   NA [3,]   NA   NA   NA   NA [4,]   NA   NA   NA  

Re: [R] A question to get all possible combinations

2010-12-22 Thread Ted Harding
On 22-Dec-10 18:19:38, Ron Michael wrote: Let say, I have a matrix with 8 rows and 6 columns:_ df1 - matrix(NA, 8, 4) df1 [,1] [,2] [,3] [,4] [1,] NA NA NA NA [2,] NA NA NA NA [3,] NA NA NA NA [4,] NA NA NA NA [5,] NA NA NA NA [6,] NA NA

Re: [R] A question to get all possible combinations

2010-12-22 Thread Daniel Nordlund
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Ted Harding Sent: Wednesday, December 22, 2010 2:39 PM To: r-help@r-project.org Subject: Re: [R] A question to get all possible combinations On 22-Dec-10 18:19:38, Ron Michael