The following returns zeros where elements do match, and NaN's where they don't 
match


mat1 <- matrix(c(1,2,1,2), 2, 2)
mat2 <- matrix(c(0,0,1,2), 2, 2)

mat1 %% mat2


______________________Scott Chamberlain
Rice University, EEB Dept.


On Tuesday, May 31, 2011 at 8:41 AM, Alaios wrote:

> Dear all,
> I have a few matrices that are roughly the same (same dimensions).
> How I can find fast which are the elements that differ?
> 
> Best Regards
> Alex
> 
> ______________________________________________
> R-help@r-project.org (mailto:R-help@r-project.org) mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to