median.php
Table of Contents
Functions
- median() : string
- Return the median value of the values in an array.
Functions
median()
Return the median value of the values in an array.
median(mixed $anyArray) : string
This helper wraps the ArangoDB AQL function MEDIAN(anyArray) which returns
the median (middle value) of all values in the given array. The median is
the value separating the higher half from the lower half of the data set.
Example AQL usage:
MEDIAN([5, 2, 9, 2]) // returns 3.5 (average of 2 and 5)
MEDIAN([1, 2, 3, 4, 5]) // returns 3 (middle value)
MEDIAN([1, 2, 3, 4]) // returns 2.5 (average of 2 and 3)
MEDIAN(doc.scores) // returns median of scores array
Parameters
- $anyArray : mixed
-
Array expression containing numeric values.
Tags
Return values
string —The formatted AQL expression.