title: Dynamically reference named list elements in for loop R
body: <p>I am trying to loop through a number of named elements in a list, using the loop indices as the reference, as so:</p>
  
  <pre><code>for (i in ref1){
    for (j in 1:2){
        for (k in ref2){
          Count &lt;- nrow(subset(list$`i.j.k`, var &gt;=0))
         }
     }
  }
  </code></pre>
  
  <p>The problem I am running into is that when I run the loop, it doesn't fill in the indices in the </p>
  
  <pre><code>lists$`i.j.k` 
  </code></pre>
  
  <p>term, and so runs into the error of trying to find the "i.j.k" entry in the list, which doesn't exist. I haven't been able to find anyone having a similar problem. How can I make it fill in the values for i, j, and k so that it will reference the correct element? Thanks.</p>