R-alpha: bug in sum
Andreas Weingessel
Andreas.Weingessel@ci.tuwien.ac.at
Tue, 3 Jun 1997 17:24:11 +0200
If the sum of a vector containing NAs is computed and na.rm is FALSE,
the result is not always NA.
R> w <- c(1:3,NA)
R> sum(w)
[1] NA
BUT
R> w <- c(NA, 1:3)
R> sum(w)
[1] 0
It seems that this problem only occurs, if the first element is NA.
Andreas
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-