Modes.RdThis function returns the mode of a vector. If the vector contains a character or factor, the most common character/factor is returned. Numbers written as characters will be compatible with non-character numbers (i.e. doubles/numeric), but the function returns a character.
This function returns the mode of a vector. If the vector contains a character or factor, the most common character/factor is returned. Numbers written as characters will be compatible with non-character numbers (i.e. doubles/numeric), but the function returns a character.
Modes(x)
Modes(x)vector from which to retrieve the mode from.
same class as 'x'.
same class as 'x'.
[tabulate()]
[tabulate()]
Modes(x = c(1, 1, 3, 0, 2, 4, 2, 1, 5, 2, 1))
#> [1] 1
Modes(x = c('a','b', 'c', 'a', 'c', 'a'))
#> [1] "a"
Modes(x = c('a', 2, 'x', 7895, 1, '2', 't', 2, 1))
#> [1] "2"
Modes(x = c(1, 1, 3, 0, 2, 4, 2, 1, 5, 2, 1))
#> [1] 1
Modes(x = c('a','b', 'c', 'a', 'c', 'a'))
#> [1] "a"
Modes(x = c('a', 2, 'x', 7895, 1, '2', 't', 2, 1))
#> [1] "2"