From jc at or.psychology.dal.ca  Sat Oct 30 18:28:57 2010
From: jc at or.psychology.dal.ca (John Christie)
Date: Sat, 30 Oct 2010 13:28:57 -0300
Subject: [Rd] IQR modification recommendation (with code!! :) )
Message-ID: <B2007DB0-8A10-4A1A-9A1C-FDC45D7930D1@or.psychology.dal.ca>

Hi,

Teaching this year I was noticing that there seems to be an odd limitation in

the IQR function.  It doesn't allow one to set the quantile type.  It seems to
me an easy thing to fix.  The current function is?


IQR <- function (x, na.rm = FALSE)  diff(quantile(as.numeric(x), c(0.25, 0.75),
na.rm = na.rm, names = FALSE))


I propose that it be changed to?


IQR <- function (x, ...)  diff(quantile(as.numeric(x), c(0.25, 0.75), names =
FALSE, ...))


The new version has exactly the same default behaviour but allows one to set all
features of the quantile function from the IQR function.  A simple pointer in
the docs to quantile, na.rm option, and maybe even mention of types (especially
type 6 when teaching students hand calculations) would be all that would be
needed.


Would this be a bad thing in any way?


John Christie


[Rd] IQR modification recommendation (with code!! :) )
John Christie