mode_frequency_range {moder} | R Documentation |
Modal frequency range
Description
mode_frequency_range()
determines the minimum and maximum
number of times that a vector's mode appears in the vector. The minimum
assumes that no NA
s are the mode; the maximum assumes that all NA
s are.
Usage
mode_frequency_range(x, max_unique = NULL)
Arguments
x |
A vector to check for its modal frequency. |
max_unique |
Numeric or string. If the maximum number of unique values
in |
Details
If there are no NA
s in x
, the two return values are identical.
If all x
values are NA
, the return values are 1
(no two x
values
are the same) and the total number of values (all x
values are the same).
Value
Integer (length 2).
See Also
mode_frequency()
, for the precise frequency (or NA
if it can't
be determined).
Examples
# The mode is `7`. It appears four or
# five times because the `NA` might
# also be a `7`:
mode_frequency_range(c(7, 7, 7, 7, 8, 8, NA))
# All of `"c"`, `"d"`, and `"e"` are the modes,
# and each of them appears twice:
mode_frequency_range(c("a", "b", "c", "c", "d", "d", "e", "e"))