title: R: creating a named vector from variables
body: <p>Inside a function I define a bunch of scalar variables like this:</p>
  
  <pre><code>a &lt;- 10
  b &lt;- a*100
  c &lt;- a + b
  </code></pre>
  
  <p>At the end of the function, I want to return <code>a,b,c</code> in a <em>named vector</em>, with the same names as the variables, with minimal coding, i.e. I <em>do not</em> want to do:</p>
  
  <pre><code>c( a = a, b = b, c = c )
  </code></pre>
  
  <p>Is there a language construct that does this? For example, if I simply do <code>return(c(a,b,c))</code> it returns an unnamed vector, which is not what I want. I currently have a hacky way of doing this: </p>
  
  <pre><code>&gt; cbind(a,b,c)[1,]
     a    b    c 
    10 1000 1010 
  </code></pre>
  
  <p>Is there perhaps a better, less hacky, way?</p>