[R] replacing with NA

Mintewab Bezabih Mintewab.Bezabih at economics.gu.se
Wed May 16 19:00:13 CEST 2012


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, 12, 28, 16,17, NA, 12, 10)


Many thanks
Mintewab


More information about the R-help mailing list