In fact, it is not as simple as it might seem. I believe that you want to get rid of NA and replace them with 0 (zeros). Another solution:
set.seed(1234)
x <- round(rnorm(10, 15, 3.2))
y <- round(runif(10, 12, 27))
z <- round(rpois(n = 10, lambda = 5))
x[c(2,3)] <- NA
y[c(1,3,7)] <- NA
z[c(3,6,10)] <- NA
And now, if you do this:
x + y + z
[1] NA NA NA 20 31 41 NA 39 37 25
So run:
x[is.na(x)] <- 0
y[is.na(y)] <- 0
z[is.na(z)] <- 0
from here:
x + y + z # yields:
[1] 16 21 0 25 34 41 16 42 48 25
, , @xiechao!
!