title: Loop simultaneously over two lists in R
body: <p>I have written a function that takes three arguments: </p>
  
  <pre><code>create.template &lt;- function(t.list, x, y){
      temp &lt;- cbind(get(t.list[x]), get(t.list[y]), NA)
  }
  </code></pre>
  
  <p>The output of this function is a data.frame with 11 columns and 17 rows.</p>
  
  <p>Now I would like to create a loop over the function with two lists, one for x and one for y. Thereby </p>
  
  <pre><code>x.list &lt;- list(1,2,3)
  y.list &lt;- list(4,5,6)
  </code></pre>
  
  <p>In the final step I would like to establish something like</p>
  
  <pre><code>for (x in x.list and y in y.list){
     create.template(t.list, x, y)
  }
  </code></pre>
  
  <p>and possibly combine the resulting dataframes (3 dataframes with 11 columns each) rowwise in one final dataframe.</p>
  
  <p>I know that you can do this in Python with the zip() function and then append the results easily by append() and concatenate(), but I have not found an equivalent in R so far. Any help is highly appreciated!</p>