mod: Mode

modR Documentation

Mode

Description

Computes the mode of a vector. The function makes the difference between continuous and discontinuous variables (which are made up of integers only). By extention, it also gives the most frequent value in a character vector or a factor.

Usage

mod(x)

Arguments

x

vector (numeric, character or factor).

Author(s)

Maxime HERVE <maxime.herve@univ-rennes1.fr>

See Also

density

Examples

# Continuous variable
x <- rnorm(100)
mod(x)

# Discontinuous variable
y <- rpois(100,2)
mod(y)

# Character vector
z <- sample(LETTERS[1:3],20,replace=TRUE)
mod(z)

RVAideMemoire documentation built on Nov. 6, 2023, 5:07 p.m.