sample_mode: Compute a sample mode

View source: R/Mode.R

sample_modeR Documentation

Compute a sample mode

Description

sample_mode computes the sample mode, i.e. the value in x with the highest frequency of occurrence. If there are multiple modes, the mode that occurs first in x is returned, with a warning that lists the other modes found.

Usage

sample_mode(x)

Arguments

x

Numeric vector

Value

A single numeric value equal to the sample mode

Examples

data(anchoring)
sample_mode(anchoring$everest_feet)
# Multiple modes give a warning:
sample_mode(c(3,3,3,1,1,1,2,2,2))

mspeekenbrink/sdam-r documentation built on Feb. 15, 2025, 4:33 a.m.