median.factor

0th

Percentile

Median for Ordered Factors

Calculate the median for ordered factors. This is not implemented in standard R, as it's not well defined (it is not clear what to do if the median sits between two levels in factors of even length). This function returns the high median and prints a warning if the low median would be different (which is supposed to be a rare event).

Keywords
univar
Usage
"median"(x, na.rm = FALSE)
Arguments
x
an ordered factor containing the values whose median is to be computed.

na.rm
a logical value indicating whether NA values should be stripped before the computation proceeds.

Details

There's a vivid discussion between experts going on whether this should be defined or not. We'll wait for definitive results and enjoy the function's comfort so far...

Value

median(d.pizza\$quality, na.rm=TRUE)