[Rd] mean(trim=, c(NA,...), na.rm=FALSE) does not return NA
William Dunlap
wdunlap at tibco.com
Tue Mar 16 17:28:09 CET 2010
Both of the following should return NA,
but do not in "R version 2.11.0 Under
development (unstable) (2010-03-07 r51225)"
on 32-bit Windows:
> mean(c(1,10,100,NA), trim=.1)
Error in sort.int(x, partial = unique(c(lo, hi))) :
index 4 outside bounds
> mean(c(1,10,100,NA), trim=.26)
[1] 55
With na.rm=TRUE they give the correct results.
(mean() would be so much simpler if we didn't
have to worry about the seldom-used trim=
argument.)
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
More information about the R-devel
mailing list