[R] strange behaviour of median

Karl Ove Hufthammer karl at huftis.org
Thu Feb 4 12:04:32 CET 2010


On Thu, 4 Feb 2010 09:32:15 +0100 Petr PIKAL <petr.pikal at precheza.cz> 
wrote:
> > median(df1)
> [1]  6.5 10.5
> 
> Rather weird, AFAIK there shall not be an issue with data frame at least I 
> did not find any in help page.

It's not exactly a bug, since 'median' is not documented to work on data 
frames (use 'sapply' or 'apply' for that), but it's certainly surprising 
and confusing behaviour. I think 'median' should either be changed to 
work on data frames, or to produce a warning when used on data frames.

-- 
Karl Ove Hufthammer



More information about the R-help mailing list