Getting the excluded elements for each of the combn(n,k) combinations
- by gd047
Suppose we have generated a matrix A where each column contains one of the combinations of n elements in groups of k. So, its dimensions will be k,choose(n,k). Such a matrix is produced giving the command combn(n,k). What I would like to get is another matrix B with dimensions (n-k),choose(n,k), where each column B[,j] will contain the excluded n-k elements of A[,j].
Here is an example of the way I use tho get table B. Do you think it is a safe method to use? Is there another way?
n <- 5 ; k <- 3
(A <- combn(n,k))
(B <- combn(n,n-k)[,choose(n,k):1])
That previous question of mine is part of this problem.
Thank you.