Mode {countries} | R Documentation |
Statistical mode of a vector
Description
This function returns the mode of vectors. That is to say, for any given vector of values, it returns the value that appears most frequently.
The function works with strings, numerical and mixed inputs. NA
values are treated as distinct values.
Usage
Mode(x, na.rm = FALSE, first_only = FALSE)
Arguments
x |
A vector |
na.rm |
Logical value indicating whether |
first_only |
Logical value indicating whether only the first mode should be returned if |
Value
Returns the mode of the vector x
Examples
countries::Mode(c("a","a",2,3))
countries::Mode(c(1,1,2,3,NA,2))
countries::Mode(c(NA,NA,NA,1,1,2))
[Package countries version 1.2.0 Index]