title: list of dataframes in R: assignment problem
body: <p>I have the following code:</p>
  
  <pre><code>child_tracks &lt;- list()
     for(i in 1:106)
     {
       for(j in 1:5)
       {
       child_tracks[[i]][[j]] &lt;- 
  all_samples[[i]][sample(nrow(all_samples[[i]]),length_breakups[[i]][[j]]),]
  
       }
     }
  </code></pre>
  
  <p>As above, "all_samples" is a list of dataframes, while "length_breakups" is a list of lists.</p>
  
  <p>When I assign the calculation to it, it throws an error 
  : subscript out of bounds. Although a singular variable can hold, a list 
  can't. For example:</p>
  
  <pre><code>temp &lt;- 
  all_samples[[i]][sample(nrow(all_samples[[i]]),length_breakups[[i]][[j]]),]
  
  child_tracks[[i]][[j]] &lt;- 
  all_samples[[i]][sample(nrow(all_samples[[i]]),length_breakups[[i]][[j]]),]
  </code></pre>
  
  <p>The former works, the latter doesn't. I've seen that the class 
  definitions are all okay and so are the ranges of the "for" loop.</p>
  
  <p>Just not getting around it. Any comments?</p>