title: lapply to add column to existing dataframes
body: <p>I have a list of data frames, and want to perform a function on each column in the data frame. </p>
  
  <p>I've been googling for a while, but the issue I have is this: </p>
  
  <pre><code>df.1 &lt;- data.frame(data=cbind(rnorm(5, 0), rnorm(5, 2), rnorm(5, 5)))
  df.2 &lt;- data.frame(data=cbind(rnorm(5, 0), rnorm(5, 2), rnorm(5, 5)))
  
  names(df.1) &lt;- c("a", "b", "c")
  names(df.2) &lt;- c("a", "b", "c")
  
  ls.1&lt;- list(df.1,df.2)
  
  
  res &lt;- lapply(ls.1, function(x){
    x$d &lt;- x$b + x$c
    return(x)
  })
  </code></pre>
  
  <p>Returns a new list "res" with a group of unnamed dataframes in them (res[[1]], res[[2]] etc). </p>
  
  <pre><code>[[1]]
             a        b        c        d
  1  2.2378686 3.640607 4.793172 8.433780
  2 -0.4411046 3.690850 5.290814 8.981664
  3 -1.1490879 3.081092 4.982820 8.063912
  4 -0.3024211 1.929033 4.743569 6.672602
  5  1.3658726 3.395564 2.800131 6.195695
  
  [[2]]
             a        b        c         d
  1  0.3452530 3.264709 7.384127 10.648836
  2 -1.2031949 3.118633 4.840496  7.959129
  3  0.6177369 1.119107 4.938917  6.058024
  4 -1.0470713 1.942357 5.747748  7.690106
  5  0.8732836 2.704501 5.805754  8.510254
  </code></pre>
  
  <p>I'm interested in adding columns to the original dataframes (df.1, df.2) How would I do this? </p>