sampleMode | R Documentation |
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. |
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.
A single value corresponding to the most common value in x.
David Braze davebraze@gmail.com
x0 <- sample(1:26, 5000, replace=TRUE) sampleMode(x0) x1 <- sample(letters, 5000, replace=TRUE) sampleMode(x1) x2 <- rnorm(100000, m=9.5) sampleMode(x2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.