getmode: Get Mode of a Vector (numeric/character/factor)
Description
Returns the mode(s) of a vector. By default, returns a single string with
all modes collapsed by comma when there are ties. If you need only one mode,
set collapse = FALSE to return the first mode deterministically.
Usage
getmode(x, collapse = TRUE)
Value
A single value (first mode) or a comma-separated string of modes.
Arguments
x
A vector (numeric, character, factor, etc.).
collapse
Logical; if TRUE (default), return all modes as a single
comma-separated string. If FALSE, return the first mode only.