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
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
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]]
_
2 matches
Mail list logo