# median.factor

From DescTools v0.99.19
by Andri Signorell

##### 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

##### See Also

https://stat.ethz.ch/pipermail/r-help/2003-November/042684.html

http://stackoverflow.com/questions/7925102/idiomatic-method-of-finding-the-median-of-an-ordinal

##### Examples

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

*Documentation reproduced from package DescTools, version 0.99.19, License: GPL (>= 2)*

### Community examples

Looks like there are no examples yet.