On Fri, Dec 12, 2014 at 11:00 AM, Kathryn Lord <kathryn.lord2...@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, > > After a relaxing weekend, it came to me that these 4x7 matrices are really just a subset of all the possible permutations of the vector 1:28, recast as 4x7 matrices. Of course, there are factorial(28) (about 3*10^29 ) such 4x7 matrices. But given your constraints, I think that these can be subsetted to only those permutations in which the values in each row are sorted in ascending (or descending) order. I am fairly certain that this subset would be exhaustive for your purposes. I not really certain how big that subset would be. I think it would be 1/168th ( 1 out of 7*factorial(4) ) of the 3*10^29 permutations, or about 1.8*10^27. Which is still way to big to actually instantiate all at once. You might be able store such a thing in a huge data base. If you're lucky, you have access to a massive supercomputer so that you can get the results before the heat death of this universe. (exaggeration?) Two R libraries seems to address this. One is combinat. The other is permute. The permute library seems, to me, to be the more likely candidate. It contains a "how()" function which __appears to me__ to perhaps be a way to subset the permutations as they are being generated. But all that I get from reading the documentation is a bad headache. I never studied combinatorics. And I got a milder headache trying to read the Wikipedia article on it. I am curious about what you will do with such a set of matrices, once you have them. If you are permitted to say. -- While a transcendent vocabulary is laudable, one must be eternally careful so that the calculated objective of communication does not become ensconced in obscurity. In other words, eschew obfuscation. Maranatha! <>< John McKown [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.