An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20131225/eec07f72/attachment.pl>
replace NA with another vector
2 messages · Kathryn Lord, arun
?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.lord2000 at 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 at 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.