title: Using lapply for multiple lists in a function
body: <p>I have 2 lists of matrices A and B:</p>
  
  <pre><code>n&lt;-10
  generate&lt;-function (n){
  matrix(runif(10*10),ncol = 10) 
  }
  A&lt;-lapply(1:n, generate)
  B&lt;-lapply(1:n, generate)
  </code></pre>
  
  <p>I am trying to use lapply to run it through a function with two inputs. Where my function is a function I have created<code>ABC()</code>:</p>
  
  <pre><code>ABC(x,y)
  </code></pre>
  
  <p>I now try to run the lists A for x and B for y by using lapply:</p>
  
  <pre><code>l&lt;-lapply(A,B, ABC(x,y))
  </code></pre>
  
  <p>This does not work as it recognises B as a function instead of a list that should be associated with y. Do I need to use <code>sapply</code> or <code>mapply</code>and if so how?</p>
  
  <p>Any help would be appreciated, thanks.</p>