mode: Get the mode of a vector.

Description Usage Arguments Value Examples

View source: R/misc.R

Description

The mode of a vector is the value that appears most often.

Usage

1
mode(x)

Arguments

x

A vector.

Value

The mode of x.

Examples

1
2
3
4
5
6
mode(c("D", "A", "B", "B", "C"))


# In case of 2 or more modi, the function returns the modus that appears
# first:
mode(c(4, 9, 1, 2, 9, 1))

unmnn/umisc documentation built on Dec. 18, 2020, 6:52 a.m.