Re: [R] replacing with NA

2012-05-17 Thread Petr PIKAL
> > x[is.na(z)] <- NA > > This might send you a nasty bug if x and z are different lengths > though -- just a head's up. Another option x*!is.na(z)*z Regards Petr > > Michael > > On Wed, May 16, 2012 at 12:55 PM, Mintewab Bezabih > wrote: > > Dear R users, > > > > I was wondering how I ca

Re: [R] replacing with NA

2012-05-16 Thread R. Michael Weylandt
x[is.na(z)] <- NA This might send you a nasty bug if x and z are different lengths though -- just a head's up. Michael On Wed, May 16, 2012 at 12:55 PM, Mintewab Bezabih wrote: > Dear R users, > > I was wondering  how I can replace the values of a vector with the values > from in another vecto

[R] replacing with NA

2012-05-16 Thread Mintewab Bezabih
Dear R users, I was wondering how I can replace the values of a vector with the values from in another vector in the same row For example, how can I replace the value of x below with NA when the value of Z in the same row is NA? x <-1:20 z<- c(11, 15, 17, 2, 18, 6, 7, NA, 12, 10,21, 25, 27,

[R] replacing with NA

2012-05-16 Thread Mintewab Bezabih
Dear R users, I was wondering how I can replace the values of a vector with the values from in another vector in the same row For example, how can I replace the value of x below with NA when the value of Z in the same row is NA? x <-1:20 z<- c(11, 15, 17, 2, 18, 6, 7, NA, 12, 10,21, 25, 27, 1