R-alpha: var() and missing

Ross Ihaka ihaka@stat.auckland.ac.nz
Sun, 25 May 1997 08:02:50 +1200 (NZST)


> var() handles missing values in a very strange way. It is not what the
> documentation says
> > var(c(NA,1:10))
> [1] 0
> > var(1:10)
> [1] 9.166667
> This is because sum() handles NA incorrectly
> > sum(NA)
> [1] 0
> > sum(NA,na.rm=T)
> [1] 0
> > sum(NA,na.rm=F)
> [1] 0

This is a bug brought in by changes to complex arithmetic.  I have a
fix and will have a patch (later today I hope).

> Also the documentation gives a pairwise= option to var() which isn't in
> the function.

I think the interpreted front end doesn't match the real back-end.
I'll change it.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-