Learn R Programming

SciencesPo (version 1.02.12)

mode: Calculate the Mode

Description

Estimates the mode for a vector

Usage

mode(x, na.rm = FALSE)

Arguments

x
A data vector
na.rm
A logical value, default is FALSE

encoding

UTF-8

Examples

Run this code
myvar <-c(1,1,2,2,3,3,4,4,5, NA)
mode(myvar)

mode(myvar, FALSE)

Run the code above in your browser using DataLab