statar (version 0.1.1)

sample_mode: Statistical mode

Description

Statistical mode

Usage

sample_mode(x, na.rm = FALSE)

Arguments

x
A vector of values
na.rm
Should NA values dropped?

Value

  • Returns one mode of the vector (in case of ties, the first value is chosen)

Examples

Run this code
sample_mode(c(1, 2, 2))
sample_mode(c(1, 2))
sample_mode(c(NA,NA,1))
sample_mode(c(NA,NA,1), na.rm = TRUE)

Run the code above in your browser using DataCamp Workspace