title: use object name in a loop
body: <p>I'm merging some data frames that are stored in a list. For that purpose I'm using a for-loop with a <code>.df</code> command. Now, I would like to use the name of the data frame as <code>suffixes</code> in a <code>paste</code> inside my loop.</p>
  
  <p>Is there a way, using the <code>for ( .df in [list]) {</code> command that I can subtract the name of the data frame currently in <code>.df</code> inside the loop?</p>
  
  <p>Say I have this list with three data frames,</p>
  
  <pre><code>a &lt;- list(A = data.frame(a=runif(2), b=runif(2)), 
            B = data.frame(a=runif(2), b=runif(2)), 
            C = data.frame(a=runif(2), b=runif(2)))
  a
  
  $A
            a         b
  1 0.2833226 0.6242624
  2 0.1741420 0.1707722
  
  $B
             a         b
  1 0.55073381 0.6082305
  2 0.08678421 0.5192457
  
  $C
             a         b
  1 0.02788030 0.1392156
  2 0.02171247 0.7189846
  </code></pre>
  
  <p>Now, I would like to use this loop,</p>
  
  <pre><code>for ( .df in a) {
   print(['command I do not know about'])
                  }
  </code></pre>
  
  <p>and then have the [command I do not know about] print out A, B, C (i.e. the name of the data frame in <code>.df</code>).</p>
  
  <p>Can I do that?</p>
  
  <h3>Update 2012-04-28 20:11:58 PDT</h3>
  
  <p>Here is a snipped of what I expect form my output using the simple loop from above,</p>
  
  <pre><code>for ( .df in a) {
   print(['command I do not know about'](a))
                  }
  
  [1] "A"
  [1] "B"
  [1] "C"
  </code></pre>
  
  <p>I could obtain this using,</p>
  
  <pre><code>for (x in names(a)) {
      print(x)
      }
  </code></pre>
  
  <p>but due to the nature of what I am doing I would like to use the <code>for ( .df in [list]) {</code> command in my for-loop.</p>