Aggregate Tables

Thierry Banel and Michael Brand have a really nifty package, orgaggregate, for those who work with data and want to produce a summary or aggregate table from their primary table.

Here’s a simple example from their GitHub repository:

#+NAME: original
| Day       | Color | Level | Quantity |
|-----------+-------+-------+----------|
| Monday    | Red   |    30 |       11 |
| Monday    | Blue  |    25 |        3 |
| Tuesday   | Red   |    51 |       12 |
| Tuesday   | Red   |    45 |       15 |
| Tuesday   | Blue  |    33 |       18 |
| Wednesday | Red   |    27 |       23 |
| Wednesday | Blue  |    12 |       16 |
| Wednesday | Blue  |    15 |       15 |
| Thursday  | Red   |    39 |       24 |
| Thursday  | Red   |    41 |       29 |
| Thursday  | Red   |    49 |       30 |
| Friday    | Blue  |     7 |        5 |
| Friday    | Blue  |     6 |        8 |
| Friday    | Blue  |    11 |        9 |

#+BEGIN: aggregate :table "original" :cols "Color count()"
| Color | count() |
|-------+---------|
| Red   |       7 |
| Blue  |       7 |
#+END:

The second table produces a summary of the number of each color that appears in the primary table.

This is only the beginning. The package is quite powerful and can use just about any Emacs Calc function to calculate the summary. To really appreciate what you can do with the package, you should look through the README at the repository. It has many more examples that show the types of things that you can do with orgaggregate.

I just stumbled across a reference to this package so I haven’t yet had a chance to use it but I’ll be giving it a try the first time an opportunity presents itself.

This entry was posted in General and tagged , . Bookmark the permalink.