title: R function similar to Excel's index-match
body: <p>I'm sure there is a fairly straight forward solution to my problem. However, my limited R-skills let me down and I didn't come across a suitable solution yet.</p>
  
  <p>I have a matrix A looking like:</p>
  
  <pre><code>     Year SIC       alpha  
  [1,] 1990  13 -0.08610973 
  [2,] 1990  15 -0.02270707  
  [3,] 1990  20  0.01273243
  [4,] 1990  25 -0.25173402 
  [5,] 1991  26 -0.02625965 
  [6,] 1991  27 -0.02685330 
  ....
  </code></pre>
  
  <p>And a matrix B which looks like</p>
  
  <pre><code>      46   27   13   37   20   ...
  1989  NA   NA   NA   NA   NA
  1990  NA   NA   NA   NA   NA
  1991  NA   NA   NA   NA   NA
  </code></pre>
  
  <p>I'd like to perform a kind of two-dimensional lookup. I want to paste the values from matrix A's column "alpha" into matrix B, where the row names of B match <code>A$Year</code> and the column names of B match <code>A$SIC</code>. So basically similar to Excel's Index-match-functions.</p>
  
  <p>The result would look like this:</p>
  
  <pre><code>      46   27             13           37   20   ...
  1989  NA   NA             NA           NA   NA
  1990  NA   NA            -0.08610973   NA   0.01273243
  1991  NA   -0.02685330    NA           NA   NA
  </code></pre>
  
  <p>I hope anyone can help me out.</p>
  
  <p>Thanks a lot in advance!</p>