Table of Contents

Marble diagram

The Average operator collects all the values from the source sequence and emits a single floating-point number representing their arithmetic mean. The single result value is emitted only when the source sequence terminates successfully.

Examples

Use Average to report the mean value at the end of the sequence.

Average Example

Signal Smoothing

Use Average to smooth a noisy signal by grouping elements with WindowCount, then applying Average inside a SelectMany.

Average Application Downsample

Note

This operation is equivalent to downsampling and reduces the number of elements in the sequence. To implement a moving average that preserves the number of elements, you can adjust the Skip property in WindowCount to create sliding windows.

Note

This example requires the Bonsai.Design.Visualizers package to be installed.