Learn R Programming

SciencesPo (version 1.3.9)

Mode: Calculate the Mode

Description

Estimates the mode for a vector

Usage

Mode(x, na.rm = FALSE)

Mode(x, na.rm = FALSE)

Mode.data.frame(x, na.rm = TRUE)

Arguments

x
An Robject.
na.rm
A logical value indicating whether NA should be stripped before the computation proceeds. 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