Return the most common value in a sample or, for numerix x with no duplicate values, return the maximum density estimate.
sampleMode(x, na.rm = FALSE)
x | A vector or matrix. |
---|---|
na.rm | If TRUE, remove NAs from x, if FALSE (default) retain them. |
A single value corresponding to the most common value in x.
Returns the mode (most common value) of a vector or matrix or, for numerix x with no duplicate values, return the maximum density estimate. For non-numeric x with no duplicates return NA. When there is more than 1 mode, return the one whose value occurs first in x.
David Braze davebraze@gmail.com
#> [1] 21#> [1] "c"#> Warning: WARNING: No value occurs more than once! Returning maximum density estimate for numeric x.#> [1] 9.505601