Learn R Programming

MSMU (version 0.1.2)

MODE: Find the Mode of a Numeric Vector

Description

Calculates the mode (most frequent value) of a numeric vector. If there is a tie, returns all values that share the highest frequency.

Usage

MODE(x)

Value

A numeric value (or vector) representing the mode(s) of x.

Arguments

x

A numeric vector.

Examples

Run this code
# Mode of a Numeric Vector
MODE(c(1,2,3,3,3,4,5,5,3,8))

# Mode of the number of cylinders in mtcars dataset
data("mtcars")
MODE(mtcars$cyl)

Run the code above in your browser using DataLab