title: Select a subset of combinations
body: <p>Suppose that I have a 20 X 5 matrix, I would like to select subsets of the matrix and do some computation with them. Further suppose that each sub-matrix is 7 X 5. I could of course do </p>
  
  <pre><code>ncomb &lt;- combn(20, 7)
  </code></pre>
  
  <p>which gives me all possible combinations of 7 row indices, and I can use these to obtain sub-matrices. But with a small, 20 X 5 matrix, there are already 77520 possible combination. So I would like to instead randomly sample some of the combinations, e.g., 5000 of them. </p>
  
  <p>One possibility is the following:</p>
  
  <pre><code>ncomb &lt;- combn(20, 7)
  ncombsub &lt;- ncomb[, sample(77520, 5000)]
  </code></pre>
  
  <p>In other words, I obtain all possible combinations, and then randomly select only 5000 of the combinations. But I imagine it would be problematic to compute all possible combinations if I had a larger matrix - say, 100 X 7.</p>
  
  <p><strong>So I wonder if there is a way to get subsets of combinations without first obtaining all possible combinations.</strong> </p>