mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-23 00:02:38 -05:00
20 lines
1.3 KiB
Plaintext
20 lines
1.3 KiB
Plaintext
{
|
|
"name": "array_majority",
|
|
"type": "function",
|
|
"groups": ["Arrays"],
|
|
"description": "Return the most common values in an array.",
|
|
"arguments": [
|
|
{"arg":"array","description":"an array"},
|
|
{"arg":"option='all'", "optional":true, "description":"a string specifying the return values handling. Valid options are:<br /><ul><li>all: Default, all most common values are returned in an array</li><li>first: Return the first of the most common values</li><li>median: Return the median of the most common values</li><li>real_majority: Return the value which occur more than half the size of the array</li></ul>"}
|
|
],
|
|
"examples": [
|
|
{ "expression":"array_majority(array(0,1,42,42,43), 'all')", "returns":"[ 42 ]"},
|
|
{ "expression":"array_majority(array(0,1,42,42,43,1), 'all')", "returns":"[ 42, 1 ]"},
|
|
{ "expression":"array_majority(array(0,1,42,42,43,1), 'first')", "returns":"42"},
|
|
{ "expression":"array_majority(array(0,1,1,2,2), 'median')", "returns":"1.5"},
|
|
{ "expression":"array_majority(array(0,1,42,42,43), 'real_majority')", "returns":"NULL"},
|
|
{ "expression":"array_majority(array(0,1,42,42,43,42), 'real_majority')", "returns":"NULL"},
|
|
{ "expression":"array_majority(array(0,1,42,42,43,42,42), 'real_majority')", "returns":"42"}
|
|
]
|
|
}
|