3. Minimum, maximum and range


The minimum and maximum of a dataset are the smallest and the largest entries, respectively. No surprise here…

The range is the difference between the maximum and the minimum, and defines the spread of the data.

Note that the range may be expressed as a single value (the actual difference between maximum and minimum) or by writing (minimum)-(maximum). For instance, in the series (1, 2, 3, 4, 5, 6, 7, 8, 9, 10), the range is 9 or 1-10.

In R, the functions to be used are min(), max() and range(). However, range() returns a vector that contains the minimum and the maximum. To get the actual difference between these values, you may use diff(range()).

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

Skjermbilde 2016-05-20 22.29.33