[Rd] quantile and IQR do not check for numeric input (PR#13631)
Duncan Murdoch
murdoch at stats.uwo.ca
Mon Mar 30 14:16:25 CEST 2009
On 3/30/2009 7:50 AM, Thomas Lumley wrote:
> 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).
I think that statement was wrong, and I fixed it last night, but then
didn't get it committed. The commit will make it into 2.9 and R-devel
today.
Duncan Murdoch
More information about the R-devel
mailing list