title: R lapply statement with index
body: <p>Is there a way I can make an lapply statement also show the index? More specifically, consider the following example:</p>
  
  <pre><code>mylist &lt;- list(c(5,4),c(3,2), c(1,3))
  
  myfunction&lt;- function(values){
    print("Adding values: ")
    return(values[1] + values[2])
  }
  
  lapply(mylist, myfunction)
  </code></pre>
  
  <p>Is there a way I can somehow make it print "Adding Values: 1" "Adding Values: 2" etc.. one element of each in the list?</p>
  
  <p>Thanks!</p>