Skip to main content
Module

x/statistics/mod.ts>median

Deno basic statistics module.
Latest
function median
import { median } from "https://deno.land/x/statistics@v0.1.1/mod.ts";

The median is the middle number in a sorted, ascending or descending, list of numbers and can be more descriptive of that data set than the average.

If there is an even amount of numbers in the list, the middle pair must be determined, added together, and divided by two to find the median value.

Examples

median([3, 2, 1, 5, 4, 6]) // => 3.5

Parameters

x: number[]

input array

Returns

number

median value