Dear all,

I'm a relative new user of R and I have a problem with merging a collection
of matrices. All matrices in this collection have the same dimension (532
rows and 532 columns), but can differ in the row and columns names. I'd like
to merge these matrices in such a way that the resulting matrix only
contains unique row- and column-names and that in case of a match between
the row or column names the smallest value is retained.

As an example says more:

A1<-matrix(c(1:9), ncol=3, byrow=TRUE)
rownames(A1)<-colnames(A1)<-c("a","b","c")
A1

  a b c
a 1 2 3
b 4 5 6
c 7 8 9

A2<-matrix(c(7,1,3,10,2,7,3,1,8),ncol=3,byrow=TRUE)
rownames(A2)<-colnames(A2)<-c("a","y","z")
A2

   a y z
a  7 1 3
y 10 2 7
z  3 1 8


I want something like this to be returned:

   a    b    c    y    z
a  1   2    3    1    3
b  4   5    6    NA NA
c  7   8    9    NA NA
y  10 NA NA  5    6
z  3  NA  NA  8    9

Many thanks,

Jurgen

I'm using: R-2.9.1 (2009-06-26) on a windows XP platform.

	[[alternative HTML version deleted]]


