title: R - Matching rows and colums of matrices with different length
body: <p>my problem at the moment is the following. I have an directed 1-mode edgelist representing pairs of actors participating in joint projects in a certain year, which might look like:</p>
  
  <pre><code>projektleader   projectpartner  year
  A               B               2005
  A               C               2000
  B               A               2002
  ...             ...             ...
  </code></pre>
  
  <p>Now I need only a subset for one particular year. Not all actors are active in very year, so the dimensions of the subsets differ. For a following Network Analysis, I need a weighted and directed adjacency matrix, so I use the option of the [network package] to create it. I first load it as a network object and transform it then in a adjacency matrix.</p>
  
  <pre><code>grants_00 &lt;- subset(grants, (year_grant=2000), select = c(projectpartner, projectleader))
  nw_00 &lt;- network(grants_08to11[,1:2], matrix="edgelist", directed=TRUE) 
  grants_00.adj &lt;- as.matrix(nw_00, matrix.type = "adjacency")
  </code></pre>
  
  <p>The resulting matrix looks somewhat like</p>
  
  <pre><code>     A    B    C    E    ...
  A    0    1    1    0
  B    1    0    0    0
  ...
  </code></pre>
  
  <p>So far so good. My problem is now: For the further analysis I am planning to do I need an adjacency Matrix for every year with the same dimension and order. That means that all actors from the initial dataset have to be the row and column names of the matrix for the corresponding years, but the matrix should only contain observed pairs for this certain year. I hope my problem is clear. I appreciate any kind of constructive solutions.</p>
  
  <p>My idea ATM is the following: I create a matrix of the initial dataset and the reduced dataset. Then I set all matrix values there to Zero. Then I somehow match it with the reduced matrix and fill it with the right values in the right rows and columns. Unfortunately I have no clue how this might be possible. </p>
  
  <p>Has anybody an idea how to solve this problem?</p>