Find the mode (i.e., most common value) in a numeric vector. In case of ties, the first encountered value is returned.
mode_value(x, na_flag = -9999)
A numeric
or logical
vector
Value used to mark NA
values in C code. This should be set to a value which is guaranteed to be absent from the input vector x
(default is -9999
).
The mode, numeric
vector of length 1
x = c(3, 2, 5, 5, 3, 10, 2, 5)
mode_value(x)
#> [1] 5