Computed Values

A pretty common requirement is to actually compute some basic statistics about your data. Most of the time those calculations happen on all the values in a specific column or a collection of columns, which is part of why we arrange our data in a column-wise manner. The result is always a single value, but it can be represented in two different ways. Depending on how your original dataset was set up, you might get two different types of values:

Null Values
Due to the way the data types work in Dataset, any non-numeric values that can't be cast to a number are ignored by these methods.

Built-in Computations:

The following are custom methods that come pre-packaged with Dataset, although you can easily add your own!

Max

You can edit the code in this block and rerun it.

Note that the max can be computed on numeric columns but also time columns!

You can edit the code in this block and rerun it.

Min

You can edit the code in this block and rerun it.

Sum

You can edit the code in this block and rerun it.

Note you can't add up dates, so don't try that one.

Mean

You can edit the code in this block and rerun it.

Adding your own

If you want to add your own computations to your dataset, take a look at src/products.js for some examples (like max and min.)

For example, if we wanted to implement a product that returned a random value from the dataset, you could do it like so:

You can edit the code in this block and rerun it.
Note that this form will also support an actual subscribable product if your dataset is syncable.

« Modifying Data

Derived Datasets »