Skip to contents

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

Value

Statistical mode(s).

Details

Calculates statistical mode(s).

Examples

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

#Calculate Statistical Mode
Mode(v1)
#> [1] 1 2
Mode(v1, multipleModes = "mean")
#> [1] 1.5
Mode(v1, multipleModes = "first")
#> [1] 1




Developmental Psychopathology Lab