Calculate Mode

Find the most frequent value(s) in an array.

Code

General
echo "$arr" | jq 'group_by(.) | map({val: .[0], count: length}) | max_by(.count).count as $max | map(select(.count == $max) | .val)'

Parameters

JSON array of numbers

Server

More Bash Snippets