John Christie
2010-Oct-30 16:28 UTC
[Rd] IQR modification recommendation (with code!! :) )
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