[Rd] quantile and IQR do not check for numeric input (PR#13631)
Thomas Lumley
tlumley at u.washington.edu
Mon Mar 30 13:50:56 CEST 2009
On Mon, 30 Mar 2009 sgiannerini at gmail.com wrote:
> This report follows the post
>
> http://tolstoy.newcastle.edu.au/R/e6/devel/09/03/0760.html
>
> where it is shown that quantile() and IQR() do not work as documented.
Nothing of the sort is shown! The thread argued that methods for these functions for ordered factors would be useful.
> In fact they do not check for numeric input even if the documentation says =
> :
>
> ?quantile
> x numeric vectors whose sample quantiles are wanted. Missing
> values are ignored.
>
> ?IQR
>
> x a numeric vector.
>
The documentation says that you are not allowed to pass anything except a numeric vector to quantile() and IQR(). It doesn't, for example, say you can pass an arbitrary vector that will be checked to see if it is numeric. If you have code that passes a factor to IQR(), the bug is in that code.
On the other hand, as someone else has since reported, the 'missing values are ignored' statement in ?quantile is wrong (or at least incomplete).
-thomas
Thomas Lumley Assoc. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle
More information about the R-devel
mailing list