[R] Weird problem with median on a factor

Christoph Bier christoph.bier at web.de
Fri Oct 31 10:52:21 CET 2003


Peter Dalgaard wrote:

> Offhand, I'd guess that the "median" is inbetween two factor levels in
> one case and not in the other. 

Hm, maybe. A problem, that would not occur, if I used the 
median on the numeric data of this factor.

> However, both cases should give an
> error, especially for unordered factors, but it is not well-defined

That's what I expected.

> for ordered factors either. If you want to interpret your factor as a
> numeric scale, use as.numeric first.

Yes, I already understood this :-) (At last we received your 
book or rather three of your books and the MASS-book).

Thanks for your answer.

Regards,

Christoph
-- 
Christoph Bier, Dipl.Oecotroph., Email: bier at wiz.uni-kassel.de
Universitaet Kassel, FG Oekologische Lebensmittelqualitaet und
Ernaehrungskultur \\ Postfach 12 52 \\ 37202 Witzenhausen
Tel.: +49 (0) 55 42 / 98 -17 21, Fax: -17 13




More information about the R-help mailing list