From wdunlap at tibco.com  Tue Mar 16 17:28:09 2010
From: wdunlap at tibco.com (William Dunlap)
Date: Tue, 16 Mar 2010 09:28:09 -0700
Subject: [Rd] mean(trim=, c(NA,...), na.rm=FALSE) does not return NA
Message-ID: <77EB52C6DD32BA4D87471DCD70C8D70002A0FD42@NA-PA-VBE03.na.tibco.com>

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 



[Rd] mean(trim=, c(NA,...), na.rm=FALSE) does not return NA
William Dunlap