Learn R Programming

datana (version 1.1.4)

moda: Computes the mode

Description

Computes the mode of a random variable.

Usage

moda(y = y)

Value

The function returns the mode, a numeric scalar.

Arguments

y

is a numeric vector.

Author

Christian Salas-Eljatib.

Details

The mode is an statistics representing the most "used" value of a random variable as a measurement of central position. We use the Spanish name of mode, i.e., "moda", to avoid any confution with the mode function of R, wich was programmed for a different use.

Examples

Run this code

library(datana)
data(casen)
head(casen)
df<-casen
#Compare 
mean(df$edad)
median(df$edad)
# Using the function
moda(df$edad)

Run the code above in your browser using DataLab