Sign in
◑
Theme
appsheet-third-party
/
d3
/
6776099c8c95cea146fb2400905ddd777fc31df1
/
.
/
src
/
arrays
/
quantile.js
blob: 67fe9fd71cd314ee64a28eb1e4fbb2c7a9bd59ec [
file
]
// R-7 per <http://en.wikipedia.org/wiki/Quantile>
d3
.
quantile
=
function
(
values
,
p
)
{
var
H
=
(
values
.
length
-
1
)
*
p
+
1
,
h
=
Math
.
floor
(
H
),
v
=
+
values
[
h
-
1
],
e
=
H
-
h
;
return
e
?
v
+
e
*
(
values
[
h
]
-
v
)
:
v
;
};