title: How to convert a non-square matrix to a square matrix with R?
body: <p>I have a network data and trying to analyze it. The problem is it has some missing rows or columns. I want to match rows and columns, so it can be a square matrix</p>
  
  <p>My data looks like this:</p>
  
  <pre><code>  A B C D E
  A 0 2 1 4 5 
  B 1 0 2 4 2
  D 2 4 0 2 2 
  E 1 2 2 2 0
  </code></pre>
  
  <p>And I want to make it looks like this:</p>
  
  <pre><code>  A  B  C  D  E
  A 0  2  1  4  5 
  B 1  0  2  4  2 
  C NA NA NA NA NA 
  D 2  4  0  2  2 
  E 1  2  2  2  0
  </code></pre>
  
  <p>As my data is very huge so I cannot do it by hands. It there any syntax to do it automatically?</p>