z <- x z[is.na(z)] <- y z #[1] 20 40 3 50 1
A.K. On Tuesday, December 24, 2013 12:06 PM, Kathryn Lord <kathryn.lord2...@gmail.com> wrote: Dear R users, I have two different vectors like below x <- c( NA, NA, 3, NA, 1) y <- c( 20, 40 ,50) Combining x and y, I'd like to create new vector z z <- c(20, 40, 3, 50, 1) Any suggestion will be greatly appreciated. Best, Kathryn Lord [[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. ______________________________________________ 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.