title: specifying column names of a data frame within a function ahead of time
body: <p>Suppose you're trying to create a data frame within a function.  I would like to be able to define the column names ahead of time as one of the parameters of the function.  Take the following code:</p>
  
  <pre><code>  foo &lt;- function(a) {
      answer &lt;- data.frame(a=1:5)
      return(answer)
      }
  </code></pre>
  
  <p>In the above example, I would like to be able to specify the value of the column name in the function <code>foo()</code>, e.g. <code>foo('my.name')</code> so that answer has the column name <code>my.name</code> instead of <code>a</code>.  I imagine you could code this up within the function using <code>colnames()</code>, but I was interested in an alternative approach.</p>