Does this work for you? which(is.nan(mat1 %% mat2), arr.ind = T)
On Tue, May 31, 2011 at 10:52 AM, Alaios <ala...@yahoo.com> wrote: > Thanks alot. > Unfortunately I can not apply this to much bigger matrices as I can not > visually check all the components. > > Regards > Alex > > --- On Tue, 5/31/11, Scott Chamberlain <scttchamberla...@gmail.com> wrote: > > From: Scott Chamberlain <scttchamberla...@gmail.com> > Subject: Re: [R] where two matrices differ? > To: "Alaios" <ala...@yahoo.com> > Cc: R-help@r-project.org > Date: Tuesday, May 31, 2011, 2:56 PM > > > 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 ChamberlainRice 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 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. > -- =============================================== Jon Daily Technician =============================================== #!/usr/bin/env outside # It's great, trust me. ______________________________________________ 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.