Learn R Programming

dprep (version 3.0.2)

moda: Calculating the Mode

Description

This function calculates the mode of a vector.

Usage

moda(x, na.rm = TRUE)

Arguments

x
A numeric vector
na.rm
A Boolean value that indicates the presence of missing values.

Value

moda
A numeric value representing the mode of the vector

Details

The function returns the mode or modes of a vector. If a tie exists, all values that are tied are returned.

Examples

Run this code
#---- Calculating the mode ----
x=c(1,4,2,3,4,6,3,7,8,5,4,3)
moda(x)

Run the code above in your browser using DataLab