This function computes the *midrange* score, i.e. the average of the lowest and highest values in a set of data. See the **Details** section below for further information.
Arguments
- x
(named) numerical vector
- i
(optional) numerical vector giving the position in
x
or character vector matching the names inx
. Ifmissing
ori = NULL
, the entirex
is considered for the computation of the score- na.rm
logical, whether to remove
NA
values fromx
before computation
Value
A numerical value representing the computed measure.
A default NA
value is returned if the score can't be
computed.
Details
The midrange score is a measure of central tendency like the mean, median, and mode. However, it is more prone to bias than these other measures because it relies solely upon the two most extreme scores, which could potentially be outliers.
Examples
x = c(0,1,1,2,3,3,3,100,NA)
midrange(x = x, na.rm = TRUE)
#> [1] 50