How can I merge multiple matrices of different dimensions in R
<p>I have these matrices of different dimensions. The <code>key.related.sheet</code> column in all matrices have some common and some uniques values. I want to match those common rows and merge all three matrices, but I also want to include unique rows as well. The result column should have <code>key.related.sheet</code>, <code>Sample_B</code> and <code>trace_1</code>,<code>trace_2</code> and <code>trace_3</code> columns only. Can someone please help me with this?</p>

<pre><code>aa&lt;-structure(c("S05-F13-P01:S05-F13-P01", "S05-F13-P01:S08-F10-P01", 
"S05-F13-P01:S08-F11-P01", "S05-F13-P01:S09-F66-P01", "S05-F13-P01", 
"S08-F10-P01", "S08-F11-P01", "S09-F66-P01", "1.25", "0.227", 
"-0.183", "-0.217"), .Dim = c(4L, 3L), .Dimnames = list(NULL, 
    c("key.related.sheet", "sample_B", "trace_1")))

bb&lt;-structure(c("S05-F13-P01:S08-F10-P01", "S05-F13-P01:S08-F11-P01", 
"S05-F13-P01:S09-F66-P01", "S05-F13-P01:S09-F67-P01", "S08-F10-P01", 
"S08-F11-P01", "S09-F66-P01", "S09-F67-P01", "0.227", "-0.183", 
"-0.217", "0.292", "Unknown", "Unknown", "Unknown", "Unknown"
), .Dim = c(4L, 4L), .Dimnames = list(NULL, c("key.related.sheet", 
"sample_B", "trace_2", "type")))

cc&lt;-structure(c("S05-F13-P01:S08-F11-P01", "S05-F13-P01:S09-F66-P01", 
"S05-F13-P01:S09-F67-P01", "S05-F13-P01:S09-F68-P01", "S05-F13-P01:S09-F01-P01", 
"S08-F11-P01", "S09-F66-P01", "S09-F67-P01", "S09-F68-P01", "S09-F01-P01", 
"-0.183", "-0.217", "0.292", "-0.314", "0.0418"), .Dim = c(5L, 
3L), .Dimnames = list(NULL, c("key.related.sheet", "sample_B", 
"trace_3")))
</code></pre>

<p>The expected output would be:</p>

<pre><code>   key.related.sheet         sample_B      trace_1   trace_2    trace_3
 "S05-F13-P01:S05-F13-P01" "S05-F13-P01" "1.25"  
 "S05-F13-P01:S08-F10-P01" "S08-F10-P01" "0.227"      "0.227"
 "S05-F13-P01:S08-F11-P01" "S08-F11-P01" "-0.183"     "-0.183"    "-0.183"   
 "S05-F13-P01:S09-F66-P01" "S09-F66-P01" "-0.217"     "-0.217"    "-0.217"
 "S05-F13-P01:S09-F67-P01" "S09-F67-P01"              "0.292"     "0.292"
 "S05-F13-P01:S09-F68-P01" "S09-F68-P01"                          "-0.314"
 "S05-F13-P01:S09-F01-P01" "S09-F01-P01"                          "0.0418"
</code></pre>