title: data.frame() : make object's string value the object name to use for columns
body: <p>I would like to use an object name as the lhs of an argument to data.frame(), but have it resolve to the string it is assigned.  I know how to take a string that has a object name and resolve that string as an object name (here: <a href="https://stackoverflow.com/questions/15677887/r-using-objects-name-to-print-what-is-inside-the-object">R: Using object&#39;s name to print what is inside the object</a>), but I want to do the reverse.  I have a work-around, which is at the bottom of the code snippet, but I have a feeling that there is some usage of <code>eval()</code> and <code>I()</code> or <code>do.call()</code>,  or maybe <code>deparse()</code> and <code>substitute()</code> that I am missing.</p>
  
  <p>It is not important now to solve the problem due to the work-around, but now I am really curious because I think the answer to this may illuminate for me some more of the inner workings of R.</p>
  
  <p>Thanks,
  Matt</p>
  
  <pre><code>h &lt;- "new_col_header"
  df &lt;- data.frame(h=1:3)
  str(df)
  
  # returns:
  # --------
  # 'data.frame':    3 obs. of  1 variable:
  #  $ h: int  1 2 3
  # --------
  # But I want the name to be 'new_col_header', not 'h'.
  
  
  ## I can do this to get what I want:
  library(plyr)
  
  h &lt;- "new_col_header"
  df &lt;- data.frame(x=1:3)
  df &lt;- rename(df, c("x" = h))
  str(df)
  
  # returns:
  # --------
  # 'data.frame':    3 obs. of  1 variable:
  #  $ new_col_header: int  1 2 3
  </code></pre>