[R] create matrices with constraint
Kathryn Lord
kathryn.lord2000 at gmail.com
Fri Dec 12 18:00:33 CET 2014
Dear all,
Suppose that I have natural numbers 1 through 28.
Based on these numbers, choose 4 numbers 7 times without replacement and
make a 4 by 7 matrix, for example,
> a1
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,] 1 5 9 13 17 21 25
[2,] 2 6 10 14 18 22 26
[3,] 3 7 11 15 19 23 27
[4,] 4 8 12 16 20 24 28
and again create another 4 * 7 matrix, say a2, in the same way; however,
every element of each column in a2 does not exist in any column of a1 like
this, e.g.
> a2
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,] 1 2 3 4 5 6 7
[2,] 8 9 10 11 12 13 14
[3,] 15 16 17 18 19 20 21
[4,] 22 23 24 25 26 27 28
>
and again create another 4 * 7 matrix, say a3, in the same way; however,
every element of each column in a3 does not exist in any column of a1 and
a2.
Using same logic, I'd like to make the matrices (a3, a4, a5....) as many as
possible.
Any suggestion will be greatly appreciated.
Best,
Kathryn Lord
[[alternative HTML version deleted]]
More information about the R-help
mailing list