I'm new to org mode and have been using Orgtbl Aggregate for tables. I import space-separated files as org tables, add an hline to make the first row into a header, name them with #+NAME (aside: is there a better way to name a table than to just write this tag by hand above it?) and then I use org-insert-dblock:aggregate
to aggregate data in a new table below.
My header-names have periods in them because they are LaTeX pgfplots-friendly. I can't use spaces, dashes, or underscores. The MWE below shows that Aggregate doesn't like the periods, and exhibits unpredictable behaviour when I try escaped quotes.
Can/should aggregate dblock work with the periods (how) or should I simply clean my headers first (this is what I ended up doing)?
#+NAME: mwe-table |
| A | b.b | cc | |
|---+-----+-----| |
| 1 | 3 | 4 | |
| 1 | 4 | 5 | |
| 2 | 6 | 7 | |
| 2 | 8 | 9 | |
#+BEGIN: aggregate :table "mwe-table" :cols "A mean(b.b) mean('b.b') mean(\"b.b\")"
| A | mean(b.b) | mean('b.b') | mean("b.b") ||
|---+---------------------------+--------------------------------+---------------||
| 1 | error(7, '"Expected `)'") | error(6, '"Expected a number") | 80.6666666667 ||
| 2 | error(7, '"Expected `)'") | error(6, '"Expected a number") | 80.6666666667 ||
#+END: |
#+BEGIN: aggregate :table "mwe-table" :cols "A mean(cc) mean(bb) mean(\'b.b\')" |
| A | mean(cc) | mean(bb) | mean('b.b') | |
|---+----------+-----------+--------------------------------| |
| 1 | 4.5 | vmean(bb) | error(6, '"Expected a number") | |
| 2 | 8 | vmean(bb) | error(6, '"Expected a number") | |
#+END: |
:cols "A mean($1) mean($2) mean($3)"
?orgtbl-to-aggregated-table-do-one-sum
is responsible for doing the actual calculation and variable names are generated there.