title: Assign names to vector entries without assigning the vector a variable name?
body: <p>In R, is it possible to assign names to components of a vector without first assigning that vector to a variable name?
  The normal way is obviously:</p>
  
  <pre><code>z &lt;- 1:3
  names(z) &lt;- c("a", "b", "c") #normal way
  names(1:3) &lt;- c("a", "b", "c") #throws an error
  </code></pre>
  
  <p>The second way throws "Error in names(1:3) &lt;- c("a", "b", "c") : 
    target of assignment expands to non-language object"</p>
  
  <p>According to the doc, the expression is evaluated as</p>
  
  <pre><code> z &lt;- "names&lt;-"(z,
       "[&lt;-"(names(z), 3, "c2"))’.
  </code></pre>
  
  <p>So no shock it doesn't work, I'm just wondering if there's a work around. </p>
  
  <p>Ideally, it'd be nice to have something like:</p>
  
  <pre><code>names(z &lt;- 1:3) &lt;- c("a", "b", "c")
  &gt; z
  a b c 
  1 2 3 
  </code></pre>
  
  <p>Just seems like a waste of space to put that on two different lines.</p>