phasedb v0.0.2 PhaseDB.Aggregates

Statistical functions which work on enumerables and reduce values.

Summary

Functions

Return the average of a stream of numbers

Return the number of elements in the enumerable

Return a list of unique elements in the enumerable

Return the first value(s) for a stream

Return the last value(s) for a stream

Return the largest value(s) for a stream

Quickly find the median of a stream of numbers

Return the smallest value(s) for a stream

Returns the nth percentile of a stream

Sum the elements in the enumerable

Functions

average(enum)

Specs

average(Enum.t) :: number

Return the average of a stream of numbers.

count(enum)

Specs

count(Enum.t) :: number

Return the number of elements in the enumerable.

Delegates to Enum.count.

distinct(enum)

Specs

distinct(Enum.t) :: Enum.t

Return a list of unique elements in the enumerable.

Delegates to Enum.uniq.

first(enum, count \\ 1)

Specs

first(Enum.t, non_neg_integer) :: Enum.t

Return the first value(s) for a stream.

Delegates to Enum.take.

last(enum, count \\ 1)

Specs

last(Enum.t, non_neg_integer) :: Enum.t

Return the last value(s) for a stream.

Returns them in reverse order.

max(enum, count \\ 1)

Specs

max(Enum.t, non_neg_integer) :: Enum.t

Return the largest value(s) for a stream.

median(enum)

Specs

median(Enum.t) :: number

Quickly find the median of a stream of numbers.

min(enum, count \\ 1)

Specs

min(Enum.t, non_neg_integer) :: Enum.t

Return the smallest value(s) for a stream.

percentile(enum, n)

Specs

percentile(Enum.t, number) :: number

Returns the nth percentile of a stream.

Here percentage is expected as a number between 0 and 1.

Note that the 50th percentile is the median and median will calculate this special case much more efficiently.

sum(enum)

Specs

sum(Enum.t) :: number

Sum the elements in the enumerable.