title: Passing more than one parameter to an anonymous function in R
body: <p>Why doesn't this work?  or is just the way R works?</p>
  
  <p>Thanks
  JJ</p>
  
  <pre><code>    a &lt;- c(1,2,3)
      b &lt;- 5
      lapply(a, function(x) print(x))  # works
  
      lapply(a, function(x,b) print(b)) # doesn't work.
  
      I get --
       Error in FUN(c(1, 2, 3)[[1L]], ...) : 
         argument "b" is missing, with no default
  </code></pre>