> For the complete documentation index, see [llms.txt](https://brianbuccaneer.gitbook.io/rxjs-stats/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://brianbuccaneer.gitbook.io/rxjs-stats/guides/gettingstarted.md).

# Quick Start

## Install

### npm

```
npm i @buccaneer/rxjs-stats --save
```

### yarn

```
yarn add @buccaneer/rxjs-stats
```

## Calculate real-time statistics!

```javascript
import { from } from 'rxjs';
import { map } from 'rxjs/operators';
import { mean } from '@buccaneer/rxjs-stats';

// create a data source
const pirate$ = from([
  {name: 'Henry Morgan', numShipsInFlotilla: 36, numOfCrew: 1900, numCannons: 240},
  {name: 'Captain Crunch', numShipsInFlotilla: 1, numOfCrew: 1, numCannons: 1},
  {name: 'BlackBeard', numShipsInFlotilla: 2, numOfCrew: 400, numCannons: 48},
]);

// describe calculations
const averageShipCount$ = pirate$.pipe(
  map(pirate => pirate.numShipsInFlotilla),
  mean()
);

// run the pipeline and do something with the results
averageShipCount$.subscribe(console.log);
```

## Next steps

* Check out the [full list of operators](https://app.gitbook.com/@brianbuccaneer/s/rxjs-stats/operators).
* Learn about [Hotstart Pipelines](https://app.gitbook.com/@brianbuccaneer/s/rxjs-stats/guides/warm-start)
