# 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)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://brianbuccaneer.gitbook.io/rxjs-stats/guides/gettingstarted.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
