2. Median

The median is another measure of the central tendency of your sample. The median is the number “in the middle” of the dataset, the middle value of a series of values sorted from the smallest to the largest.

Providing that your dataset contain an odd number n of entries, the median is the value of the ((n+1)/2)th entry in the dataset. If the dataset contains an even number n of entries, then the median is the average of the values of the (n/2)th and ((n/2)+1)th entries.

In R, the function that calculates the median is called median():

my.dataset <- c(1,2,3,4,5,6,7,8,9,10)

Skjermbilde 2016-05-20 22.20.21