Thanks Rui,It worked..
Eliza
> Date: Sun, 19 May 2013 22:27:41 +0100
> From: ruipbarra...@sapo.pt
> To: eliza_bo...@hotmail.com
> CC: r-help@r-project.org
> Subject: Re: [R] coping zeros from matrix to another
> 
> Hello,
> 
> Try the following.
> 
> set.seed(27846)
> A <- matrix(sample(0:2, 16, TRUE), ncol = 4)
> B <- matrix(1:16, ncol = 4)
> 
> zeros <- which(A == 0, arr.ind = TRUE)
> B[zeros] <- 0
> 
> 
> Hope this helps,
> 
> Rui Barradas
> 
> Em 19-05-2013 22:05, eliza botto escreveu:
> > Dear useRs,i have two distance matrices A and B. The distances in A are 
> > linked with distances in B. What i want to do is the following...There are 
> > some points in A where distances are zero(those points are apart from usual 
> > diagonal of zero values).Whereas, in B the distances at those points are 
> > not necessarily zeros . i want "0" at those points in B where distance in A 
> > is zero. How can i do that??i hope my question is clearthanks indeed in 
> > advance,Eliza                                   
> >     [[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.
> >
                                          
        [[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