d3.quantile(array, p[, accessor])
Returns the p-quantile of the given sorted array of numbers, where p is a number in the range [0, 1]. For example, the median can be computed using p = 0.5, the first quartile at p = 0.25, and the third quartile at p = 0.75. This particular implementation uses the R-7 method, which is the default for the R programming language and Excel. For example:
var a = [0, 10, 30]; d3.quantile(a, 0); // 0 d3.quantile(a, 0.5); // 10 d3.quantile(a, 1); // 30 d3.quantile(a, 0.25); // 5 d3.quantile(a, 0.75); // 20 d3.quantile(a, 0.1); // 2
An optional accessor function may be specified, which is equivalent to calling array.map(accessor) before computing the quantile.
Please login to continue.