Skip to content
Prev 337008 / 398502 Next

matrix merging question

Hi,
I am not sure about your final result.? In your initial post, you mentioned "but with row names that need to be matched".? Anyway, this gives me symmetric matrix
##rownames are the same as colnames for each matrix, so:

uNrownames <- unique(as.vector(sapply(lst2,rownames)))
res <- matrix(0,nrow=length(uNrownames), ncol=length(uNrownames), dimnames=list(uNrownames,uNrownames))
?for(i in seq_along(lst2)){
?res[rownames(lst2[[i]]),rownames(lst2[[i]])] <- res[rownames(lst2[[i]]),rownames(lst2[[i]])] + lst2[[i]]
?res
?}


isSymmetric(res)
#[1] TRUE
dim(res)
#[1] 90 90


A.K.
On Tuesday, February 25, 2014 4:17 PM, Elio Shijaku <selius at gmail.com> wrote:
Hi Arun,

Yes, I figured that, thanks a lot for your help.

Howver, when I test res1 for symmetricity I get:
I need the final matrix to be symmetric.


Any idea?


E.
On Tue, Feb 25, 2014 at 10:14 PM, arun <smartpink111 at yahoo.com> wrote:
Hi,