powered by
Computes the statistical mode, i.e. the value that appears most often in a vector. Returns the first match, if TRUE for multiple values.
stat_mode(x, ..., na.rm = FALSE)
The statistical mode with the same type as the input vector x.
A vector of data values.
Further arguments, currently unused.
a logical evaluating to TRUE or FALSE indicating whether NA values should be stripped before the computation proceeds.
TRUE
FALSE
NA
vector_numeric <- sample(1:5, 15, TRUE) vector_numeric stat_mode(vector_numeric) vector_character <- sample(LETTERS[1:5], 15, TRUE) vector_character stat_mode(vector_character)
Run the code above in your browser using DataLab