title: append named vector in R
body: <p>In R how to create and append 'named' vector. My current approach is to create separate names vector and assign names later.</p>
  
  <pre><code>v = c()
  vName = c()
  for (i in 1:5) {
    # do something complicated and store output
    k = i*i ## or get output from any other function 
    v = c(v,k)
    vName = c(vName, k)
  }
  names(v) = vName
  </code></pre>
  
  <p>Is there a better way to do it?</p>