From Andreas.Weingessel@ci.tuwien.ac.at  Tue Jun  3 16:24:11 1997
From: Andreas.Weingessel@ci.tuwien.ac.at (Andreas Weingessel)
Date: Tue, 3 Jun 1997 17:24:11 +0200
Subject: R-alpha: bug in sum
Message-ID: <199706031524.RAA22384@elendil.ci.tuwien.ac.at>


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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


R-alpha: bug in sum
Andreas Weingessel