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 a 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, respectively. 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)
## [1] 1
max(my.dataset)
## [1] 10
range(my.dataset)
## [1] 1 10
diff(range(my.dataset))
## [1] 9