Determine the most common value in a vector. If two values have the same frequency, the first occurring value is used.

mode(x, na.rm = FALSE)

Arguments

x

a vector

na.rm

If TRUE: Remove nas before the calculation is done

Value

the most common value in the vector x

Examples

mode(c(0, 3, 5, 7, 5, 3, 2))
#> [1] 3