modus: Mode (modus)

Description Usage Arguments Value Author(s) See Also Examples

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 kpm.nachtmann@gmail.com

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 May 23, 2019, 12:04 p.m.