title: preserve list elements as names in lapply function
body: <p>Say I have the following:</p>
  
  <pre><code>seq&lt;-c(2,3,4)
  added&lt;-lapply(1:length(seq),function(i){
         seq[i]+1
         }
  )
  
  &gt; added
  [[1]]
  [1] 3
  
  [[2]]
  [1] 4
  
  [[3]]
  [1] 5
  </code></pre>
  
  <p>How do I use the list elements in <code>seq</code> to name the list elements of 'added'?</p>
  
  <p>i.e.</p>
  
  <pre><code>&gt; added
    [[2]]
    [1] 3
  
    [[3]]
    [1] 4
  
    [[4]]
    [1] 5
  </code></pre>
  
  <p>thank you</p>
  
  <p><em>ACCEPTED SOLUTION</em> from @akrun</p>
  
  <pre><code>seq&lt;-c(2,3,4)
  added&lt;-setNames(lapply(1:length(seq),function(i){
  seq[i]+1
  }
  ),seq1)
  </code></pre>