modalValue | R Documentation |
Find modal value of a vector. If there are multiple modal values, all will be returned.
modalValue(x, na.rm = FALSE)
x |
Vector. |
na.rm |
Logical variable. |
Before this package was released, it returned only the first mode if there were multiple modes. It now returns all modes. See the examples.
Ken Williams. See http://stackoverflow.com/a/8189441/697473.
modalValue(qw("a b b")) # [1] "b" modalValue(qw("a a b b c")) # [1] "a" "b" modalValue(1:3) # [1] 1 2 3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.