title: How do I split a matrix with different column sizes?
body: <pre><code>n &lt;- c(12,24)
  mu&lt;-c(6.573,6.5)
  sigma&lt;-sqrt(0.25)
  Diseased.Data&lt;-round(rnorm(n[1], mu[1], sigma), 4)
  Healthy.Data&lt;-round(rnorm(n[2], mu[2], sigma), 4)
  g &lt;- c(2,3,4)
  for(i in 1:3){
    pool.dis.data &lt;- matrix(NA,n[1]/g[i],n[1]/g[i])
   for(j in n[1]/g[i]){
     pool.dis.data &lt;- replicate(n[1]/g[i],mean(sample(Diseased.Data,g[i])))
   }
  }
  </code></pre>
  <p>When I run the code above, I get only the answer from the last element of g. What I need is each column in the matrix to have an element from <code>g</code>. For example, the matrix should look like:</p>
  <pre><code>m &lt;- cbind(a1,a2,a3,a4,a5,a6)
  m1 &lt;- cbind(b1,b2,b3,b4) 
  m2 &lt;- cbind(c1,c2,c3)
  </code></pre>