math.mode(
$arg as (String | Number | Boolean | null | Array | Object)[],
[$options as String[]]
) as ValueIterator

Summary

Returns the mode of a sequence. The mode is the value that occurs most
frequently in a data set. If no value occurs more than once in the data
set, the function returns the empty sequence. If the input is the empty
sequence, the function returns the empty sequence.

Note that a data set can have multiple “modes”. The order of multiple
modes in the returned sequence is undefined.

Also note that values from a lexicon lookup are repeated
cts:frequency times before calculating the mode.

The function can be used on numeric values, xs:yearMonthDuration,
xs:dayTimeDuration, xs:string,
xs:anyURI, xs:date,
xs:dateTime, xs:time,
and cts:point.

Parameters

$arg

The sequence of values.

$options

Options. The default is ().

Options include:

"collation=URI"

Applies only when $arg is of the xs:string type. If no specified,
the default collation is used.

"coordinate-system=name"

Applies only when $arg is of the cts:point type. If no specified,
the default coordinate system is used.

## Comments