Mode: Mode

Description Usage Arguments Details Value Examples

Description

Calculate the mode of a vector.

Usage

1
Mode(x, na.rm = FALSE)

Arguments

x

A vector.

na.rm

A single logical value; should NAs be removed before proceeding?

Details

This was adapted from the web.

Value

The mode of x. If there are several modes, it returns the smallest one.

Examples

1
2
3
4
Mode(c(1,1,2,2)) # will find the smallest
Mode(c("1", "1", "2", "3"))
Mode(c(TRUE, TRUE, FALSE, FALSE, FALSE, NA))
Mode(factor(c("M", "F", "M")))

eheinzen/Ethan documentation built on May 3, 2019, 4:32 p.m.