title: R: Soft code rbind within a loop
body: <p>I have a large</p>
  
  <pre><code>GbyEbyA&lt;-array(NA,c(50,1,10,900)) 
  </code></pre>
  
  <p>of data and I would like to soft code this so that if i change the third dimension of my array the loop will adjust (e.g. if I change from 10 environments to 5). </p>
  
  <pre><code>comb&lt;-list()
  for(i in 1:length(acc)){
  comb[[i]]&lt;-rbind(GbyEbyA[,,1,i],GbyEbyA[,,2,i],GbyEbyA[,,3,i],GbyEbyA[,,4,i],GbyEbyA[,,5,i],
                   GbyEbyA[,,6,i],GbyEbyA[,,7,i],GbyEbyA[,,8,i],GbyEbyA[,,9,i],GbyEbyA[,,10,i])
  }
  </code></pre>
  
  <p>Is there a way to soft code this to something like this example (obviously this does not work):</p>
  
  <pre><code>comb&lt;-list()
  for(i in 1:length(acc)){
  comb[[i]]&lt;-rbind(get(paste("GbyEbyA[,,",1:10,",",i,"]",sep="")))
  }
  </code></pre>
  
  <p>Thanks!</p>