[R] median() function on zoo objects

Marc Chiarini marc.chiarini at tufts.edu
Sat Sep 12 19:14:34 CEST 2009


Hello R-help community:

I have what I think is a simple question that I hope someone can 
answer.  When using the median() function on any zoo object (in 
particular, mine is an irregular time series), I get the following 
error, which is thrown from .gt():

Error in if (xi == xj) 0L else if (xi > xj) 1L else -1L :
  argument is of length zero

median() of course works fine on the coredata() of my zoo object, but 
not on the object itself.

Is the median.default function coded incorrectly for zoo objects?  If 
not, then I don't understand why functions like mean() and sd() work 
correctly on the same zoo object, but not median().  Am I asking the 
right questions?  Thanks for any help you can offer.

Regards,
Marc




More information about the R-help mailing list