avg

Table of Contents

Aggregate Function

avg — average value

Synopsis

avg(number) -> number

Description

The avg aggregate function computes the mathematical average value of its input.

Examples

Average value of simple sequence:

avg(this)
1
2
3
4 
Loading...

Continuous average of simple sequence:

yield avg(this)
1
2
3
4 
Loading...

Unrecognized types are ignored:

avg(this)
1
2
3
4
"foo" 
Loading...

Average of values bucketed by key:

avg(a) by k | sort
{a:1,k:1}
{a:2,k:1}
{a:3,k:2}
{a:4,k:2} 
Loading...
Next: collect

SuperDB