Mode {petersenlab}R Documentation

Statistical Mode.

Description

Calculate statistical mode.

Usage

Mode(x, multipleModes = "all")

Arguments

x

Numerical vector.

multipleModes

How to handle multiple modes. One of:

  • "mean" = if there are multiple modes, take the mean of all modes

  • "first" = if there are multiple modes, select the first mode

  • "all" = if there are multiple modes, return all modes

Details

Calculates statistical mode(s).

Value

Statistical mode(s).

See Also

https://stackoverflow.com/questions/2547402/how-to-find-the-statistical-mode/8189441#8189441

Other computations: meanSum(), mySum()

Examples

# Prepare Data
v1 <- c(1, 1, 2, 2, 3)

#Calculate Statistical Mode
Mode(v1)
Mode(v1, multipleModes = "mean")
Mode(v1, multipleModes = "first")


[Package petersenlab version 1.0.0 Index]