title: mapply with list and vector
body: <p>Say I have a list with 3 elements -- each being a data frame --, a vector with 3 elements, and I want to apply a function to each element of the list and its respective element in the vector. Of course I could do this with a loop, but I am trying to vectorize it with <code>mapply</code>. Here's what I am doing</p>
  
  <pre><code>myList = list(data.frame(x = 1:10), data.frame(x = 1:5), data.frame(x = 6:1))
  myVec = c(7, 1, 9)
  myFun = function(x, y) {
      x$number = y
      return(x)
  } 
  res = mapply(myFun, myList, myVec)
  </code></pre>
  
  <p><code>res</code> is NOT what I expected:</p>
  
  <pre><code>str(res)
  List of 6
   $ : int [1:10] 1 2 3 4 5 6 7 8 9 10
   $ : num [1:10] 7 7 7 7 7 7 7 7 7 7
   $ : int [1:5] 1 2 3 4 5
   $ : num [1:5] 1 1 1 1 1
   $ : int [1:6] 6 5 4 3 2 1
   $ : num [1:6] 9 9 9 9 9 9
   - attr(*, "dim")= int [1:2] 2 3
   - attr(*, "dimnames")=List of 2
    ..$ : chr [1:2] "x" "number"
    ..$ : NULL   
  </code></pre>
  
  <p>what I expected was a list with three elements, each being a data frame with two columns, like so:</p>
  
  <pre><code>str(expected)
  List of 3
   $ :'data.frame':   10 obs. of  2 variables:
    ..$ x     : int [1:10] 1 2 3 4 5 6 7 8 9 10
    ..$ number: num [1:10] 7 7 7 7 7 7 7 7 7 7
   $ :'data.frame':   5 obs. of  2 variables:
    ..$ x     : int [1:5] 1 2 3 4 5
    ..$ number: num [1:5] 1 1 1 1 1
   $ :'data.frame':   6 obs. of  2 variables:
    ..$ x     : int [1:6] 6 5 4 3 2 1
    ..$ number: num [1:6] 9 9 9 9 9 9
  </code></pre>
  
  <p>what am I doing wrong?</p>