Re: [R] coping zeros from matrix to another

2013-05-19 Thread eliza botto
Thankyou very much Arun,it has even been simplified.. Eliza > Date: Sun, 19 May 2013 14:49:43 -0700 > From: smartpink...@yahoo.com > Subject: Re: [R] coping zeros from matrix to another > To: eliza_bo...@hotmail.com > > #or > just > B[A==0]<-0 > > > >

Re: [R] coping zeros from matrix to another

2013-05-19 Thread arun
   #3  0.0 28.19574  #4  0.0 55.70458 33.25658 #5  0.0 41.97618 31.35283 24.55606 A.K. - Original Message - From: eliza botto To: "r-help@r-project.org" Cc: Sent: Sunday, May 19, 2013 5:05 PM Subject: [R] coping zeros from matrix t

Re: [R] coping zeros from matrix to another

2013-05-19 Thread eliza botto
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(27

Re: [R] coping zeros from matrix to another

2013-05-19 Thread Rui Barradas
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.

[R] coping zeros from matrix to another

2013-05-19 Thread eliza botto
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