title: How to find matrix with most rows in a list-of-matrices, then make all the matrices have those dimensions?
body: <p>I have very big list. every element of this list is a matrix. but the dimention of matrix (number of rows of it) is differnet in every element of list, but all of the element of thelist are subset of one of the element of list.</p>
  
  <p>My goal is to find the element of list whith largest dimension, and compare the other element of list with this refrence element and add to the other coordinate the missing row names with value correspond to zero.</p>
  
  <p>Would someone help me to implement it in R ? </p>
  
  <p>Here is simple example of what i want:  </p>
  
  <pre><code>&gt; P
  [[1]]
    [,1]
  A    1
  B    2
  C    3
  D    4
  
  [[2]]
    [,1]
  A    1
  B    2
  D    3
  
  [[3]]
    [,1]
  B    1
  C    2
  </code></pre>
  
  <p>Expected output is: </p>
  
  <pre><code>&gt; P
  [[1]]
    [,1]
  A    1
  B    2
  C    3
  D    4
  
  [[2]]
    [,1]
  A    1
  B    2
  D    3
  C    0
  
  [[3]]
    [,1]
  B    1
  C    2
  D    0
  A    0
  </code></pre>