# Median
The median is the center of your data set. A way of thinking about how to calculate it is lay all your numbers out in a line in order of least to greatest. Then remove one from each side until you're left with 1 or 2 numbers. The numbers you are left with will tell you the median value:
| First Num | Second Num |
| ------- | -------- |
| 5 | 7 |
with 2 numbers we take the [[Mean]] of those 2 numbers or:
$\frac{(5 + 7)}{2}=6$
$\frac{12}{2}=6$
If you are left with only 1 number after equally removing values from both sides then *that* number is your median or central point of your data.
| First Num | Second Num | Third Num|
| ------- | -------- |-------- |
| 5 | 7 | 9|
In this case you remove `5` and then remove `9` and you are left with `7` this is the median of that small sample.
# Code
```r
# Documentation
median(x)
```
---
References:
- [[Mode]]
- [[Mean]]