title: In R, how to get an object's name after it is sent to a function?
body: <p>I am looking for the reverse of <code>get()</code>.</p>
  
  <p>Given an object name, I wish to have the character string representing that object extracted directly from the object.</p>
  
  <p>Trivial example with <code>foo</code> being the placeholder for the function I am looking for.</p>
  
  <pre><code>z &lt;- data.frame(x=1:10, y=1:10)
  
  test &lt;- function(a){
    mean.x &lt;- mean(a$x)
    print(foo(a))
    return(mean.x)}
  
  test(z)
  </code></pre>
  
  <p>Would print:</p>
  
  <pre><code>  "z"
  </code></pre>
  
  <p>My work around, which is harder to implement in my current problem is:</p>
  
  <pre><code>test &lt;- function(a="z"){
    mean.x &lt;- mean(get(a)$x)
    print(a)
    return(mean.x)}
  
  test("z")
  </code></pre>