modes: Calculating the Mode

Description Usage Arguments Value Examples

Description

Determines which number(s) in the vector are the most frequently occurring.

Usage

1
modes(input, order = TRUE, na.rm = FALSE)

Arguments

input

a vector of numbers

order

whether the modes should be sorted

na.rm

true or false for whether to remove NA's before performing the calculation

Value

A vector of the most frequently occurring numbers

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
a <- c(1,2,3,3)
modes(a)

b <- c(1,2,2,2,3,3,3,4,4)
modes(b)

d <- c(2,4,3,3,NA,NA,NA)
modes(d)

e <- c(2,4,3,3,NA,NA,NA)
modes(e)

Andy-McCarthy/BasicMath documentation built on May 27, 2019, 7:24 a.m.