Is there any way to "force" 0 * NA to be 0 instead of NA?

For example, suppose I have a vector with some valid values, while
other values are NA. If I matrix-pre-multiply this by a weight 
row vector, whose weights that correspond to the NAs are zero,
the outcome will still be NA:

x <- c(1, NA, 1)
wt <- c(2, 0, 1)
wt %*% x # NA

Alberto Monteiro

______________________________________________
R-help@stat.math.ethz.ch 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.

Reply via email to