[R] create matrices with constraint

peter dalgaard pdalgd at gmail.com
Fri Dec 12 19:17:21 CET 2014


> On 12 Dec 2014, at 18:00 , Kathryn Lord <kathryn.lord2000 at gmail.com> wrote:
> 
> 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
>> 
> 

No comprendo... In which sense does e.g. "1" in the first column of a2 not exist in any column of a1???? 


-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list