R-beta: odd result with sum -- yes, fixed.

Martin Maechler maechler at stat.math.ethz.ch
Fri Aug 22 14:57:43 CEST 1997


>>>>> "RL" == Richard Lammers <lammers at edac.sr.unh.edu> writes:

    RL> I am using R 0.49 and I did not see this in the archives:

It was a bug; and it has been corrected a while.
Unfortunately, there hasn't been a new beta release of R in the mean time.

    RL> Given sum() defaults to na.rm = FALSE, should both of these results
    RL> be NA?

    > sum(c(1,NA))
    RL> [1] NA
    > sum(c(NA,1))
    RL> [1] 0

This is the current [0.50-a3 "alpha"]  (and desired) behavior :

> sum(c(1,NA)); sum(c(NA,1))
[1] NA
[1] NA
> sum(c(1,NA), na.rm=TRUE); sum(c(NA,1),na.rm=TRUE)
[1] 1
[1] 1
> 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
r-help 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-help-request at stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



More information about the R-help mailing list