mode: Find the modal value of a vector.

Description Usage Arguments Value Examples

View source: R/helper_functions.R

Description

Find the modal value of a vector.

Usage

1
mode(x, na.rm = TRUE, all.modes = FALSE)

Arguments

x

A vector-like object.

na.rm

A logical. Whether to remove NAs when computing.

all.modes

A logical. Indicate whether to return all modes.

Value

Single mode or vector of all modal values.

Examples

1
2
3
var <- c(1, 1, 2, 2, 3)
mode(var)
mode(var, all.modes = TRUE)

dmolitor/umbrella documentation built on Nov. 10, 2020, 1:25 a.m.