title: How to match elements of two list in R considering the order of data frames
body: <p>Hi everybody I am working with two list of data frames in R. I want to solve a little question I have the same number of data frames in each list and each one are in the same position. The dput version of my two lists is the next:</p>
  
  <pre><code>list1=structure(list(a1 = structure(list(a1 = c("001", "002", "003"
  ), b1 = c(12, 13, 12)), .Names = c("a1", "b1"), row.names = c(NA, 
  -3L), class = "data.frame"), a2 = structure(list(a1 = c("005", 
  "006", "009"), b1 = c(12, 16, 16)), .Names = c("a1", "b1"), row.names = c(NA, 
  -3L), class = "data.frame"), a3 = structure(list(a1 = c("011", 
  "012", "053"), b1 = c(2, 3, 12)), .Names = c("a1", "b1"), row.names = c(NA, 
  -3L), class = "data.frame")), .Names = c("a1", "a2", "a3"))
  
  list2=structure(list(b1 = structure(list(d1 = c("001", "002", "003"
  ), c1 = c("A", "B", "C")), .Names = c("d1", "c1"), row.names = c(NA, 
  -3L), class = "data.frame"), b2 = structure(list(d1 = c("005", 
  "006", "009"), c1 = c("D", "E", "F")), .Names = c("d1", "c1"), row.names = c(NA, 
  -3L), class = "data.frame"), b3 = structure(list(d1 = c("011", 
  "012", "053"), c1 = c("G", "H", "I")), .Names = c("d1", "c1"), row.names = c(NA, 
  -3L), class = "data.frame")), .Names = c("b1", "b2", "b3"))
  </code></pre>
  
  <p>I want to match all data frames in <code>list1</code> with their respective data frame in <code>list2</code> considering a match between the variable <code>a1</code> for elements in <code>list1</code> and the variable <code>d1</code> for elements in <code>list2</code> that are like a ID in each data frame, with this match I would add <code>c1</code> variable from each data frame allocated in <code>list2</code> to data frames in <code>list1</code>. I want to get a new list with something like this:</p>
  
  <pre><code>list.final
  
  $a1
  
  a1 b1 c1
  001 12  A
  002 13  B
  003 12  C 
  
  $a2
  
  a1 b1 c1
  005 12  D
  006 16  E
  009 16  F
  
  $a3
  a1 b1 c1
  011  2  G
  012  3  H
  053 12  I
  </code></pre>
  
  <p>I am trying to build a function to make this match but is so complex because I only has some knowledge over individual lists and here I have to work with two lists that can have more than 20 data frames. If I could have a function I would use <code>llply</code> function from <code>plyr</code> to make the new list but I can't find a solution. Thanks.</p>