mode: Finds the mode of an array

Description Usage Arguments Value Examples

View source: R/mode.R

Description

Given an array, will find the most common element, or mode.

Usage

1
mode(x, tie = c("first", "last", "random"), na.rm = FALSE)

Arguments

x

List of elements

tie

String of how to handle ties

na.rm

Boolean, remove NA elements before evaluating

Value

mode of x

Examples

1
2
3
4
5
6
7
vals <- c(2, 2, 1, 1, 3, 3)

mode(vals, tie='first')
mode(vals, tie='last')
for (i in 1:10){
  print(mode(x0, tie='random'))
}

Beachnad/dbr documentation built on Nov. 6, 2019, 8:07 p.m.