title: Running average with rxjs 5
body: <p><em>I would like to observe rolling averages with rxjs ^5</em></p>
  
  <h2>Half-solution</h2>
  
  <pre><code>const data$ = Rx.Observable.range(1, 9);
  const dataToAverage$ = data$.bufferCount(4, 1);
  const movingAverage$ = dataToAverage$.map(arr =&gt;
                         arr.reduce((acc, cur) =&gt; acc + cur) / arr.length);
  </code></pre>
  
  <ul>
  <li>The above code works fine, except that the first data array it averages is <code>1,2,3,4</code>.</li>
  <li>How could I average <code>1</code> and <code>1,2</code> and <code>1,2,3</code> as well?</li>
  <li>Have a play at <a href="https://jsfiddle.net/KristjanLaane/kLskp71j/" rel="nofollow noreferrer">https://jsfiddle.net/KristjanLaane/kLskp71j/</a></li>
  </ul>