modalValue: Find modal value of a vector.

View source: R/modalValue.R

modalValueR Documentation

Find modal value of a vector.

Description

Find modal value of a vector. If there are multiple modal values, all will be returned.

Usage

modalValue(x, na.rm = FALSE)

Arguments

x

Vector.

na.rm

Logical variable.

Details

Before this package was released, it returned only the first mode if there were multiple modes. It now returns all modes. See the examples.

Author(s)

Ken Williams. See http://stackoverflow.com/a/8189441/697473.

Examples

modalValue(qw("a b b"))      # [1] "b"
modalValue(qw("a a b b c"))  # [1] "a" "b"
modalValue(1:3)              # [1] 1 2 3


jbullock35/Bullock documentation built on April 1, 2022, 6:21 p.m.