title: Automatically add variable names to elements of a list
body: <p>I have a list of models, and to make the code easiser to maintain (so roubst to adding and removing models) I'd like to have a single place where I store them and their names. To do this I have to solve the following naming problem. </p>
  
  <p>Upstream, i have generated models in a way that's less efficient than the following (if it was this compressed, i would <code>assign</code> them to their own <code>env</code>). </p>
  
  <pre><code>lmNms &lt;- c( "mod1", "mod2", "mod3", "mod4", "mod5", "mod6")
  lapply(lmNms, function(N) assign(N, lm(runif(10) ~ rnorm(10)), env = .GlobalEnv))
  </code></pre>
  
  <p>Downstream, i have collected the mess into a list: </p>
  
  <pre><code>modelList &lt;- list(mod1, mod2, mod3, mod4, mod5, mod6)
  </code></pre>
  
  <p>I have an (un-named) lists of variable output, and attach the names as follows: </p>
  
  <pre><code>output &lt;- list(1, 2, 3, 4, 5, 6)
  names(output) &lt;- lmNms
  </code></pre>
  
  <p>I'd like to be able to use the model names from <code>modelList</code>:</p>
  
  <pre><code>modelList &lt;- list(mod1, mod2, mod3, mod4, mod5, mod6)
  names(output) &lt;- someFun(modelList)
  </code></pre>
  
  <p>I'm sure there exists <code>someFun</code> -- but I cannot figure it out ... can this be done? </p>
  
  <p>To be clear, the aim is to do this <strong>without</strong> using <code>lmNms</code> -- i want to get the names either from <code>modelList</code>, or have them attach at the point that i build <code>modelList</code> (the point is to avoid <code>list(a = a, b=b ...)</code> boilerplate. </p>