Re: [R] Combining information from two matrices

2013-09-11 Thread Bert Gunter
Your "solution" is unnecessarily complicated. There is no need to convert to data frames and no need to eval labels -- simple indexing by column and row names will do. I think the following code is pretty self-explanatory: (Starting with the same mat1 and mat2) rnames <- setdiff(rownames(mat2),

Re: [R] Combining information from two matrices

2013-09-11 Thread arun
Hi, May be this helps: mat1<- matrix(c(1,1,0,0,0,1,0,1,0),ncol=3,dimnames=list(paste("Plant",1:3), paste("Pollinator",1:3)),byrow=TRUE)  mat2<- matrix(c(1,1,0,1,0,1,0,1,0),ncol=3,dimnames=list(paste("Plant",c(1,4,5)), paste("Pollinator",c(1,2,4))),byrow=TRUE) dat1<- as.data.frame(mat1)  dat2<-