modus: Mode (modus)

Description Usage Arguments Value Author(s) See Also Examples

View source: R/modus.R

Description

Calculate the most frequent value (modus) of a vector. Missing values (NA) are ignored.

Usage

1
modus(x)

Arguments

x

a vector containing the values whose modus is to be computed.

Value

A single value containing the most frequent value (modus) of x. For bi- or multimodal distributions with equal peaks, the first one is returned (see examples).

Author(s)

Gerhard Nachtmann [email protected]

See Also

median, mean

Examples

1
2
3
4
5
6
x <- round(rnorm(1000), 1)
modus(x)
y <- sample(letters, 100, replace = TRUE)
modus(y)
modus(c(1, 1, 2, 2))
modus(c("b", "b", "a", "a"))

nachti/STATtools documentation built on Aug. 4, 2018, 5:58 p.m.