R-alpha: var() and missing
Ross Ihaka
ihaka@stat.auckland.ac.nz
Mon, 26 May 1997 10:09:47 +1200 (NZST)
Thomas Lumley writes:
>
>
> 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
>
> Also the documentation gives a pairwise= option to var() which isn't in
> the function.
I did want to move toward an implementation which is more like
"na.action", rather than "na.rm". Often computations based on
correlations based on all observations which are complete for pairs of
variables do make sense.
"var" seems to have been skipped. What is the right strategy here?
Ross
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-