emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] table formula help...


From: Eric Abrahamsen
Subject: Re: [O] table formula help...
Date: Sun, 07 Dec 2014 11:25:34 +0800
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

Thierry Banel <address@hidden> writes:

> To elaborate on Michael's first suggestion,
> we will first give a name ("work") to the table:
>
>   #+TBLNAME: work
>   | Chars | Lines | Translator      |
>
>   |-------+-------+-----------------|
>   |       |    84 | Austin Woerner  |
>   |  6633 |       | Eric Abrahamsen |
>   | 16984 |       | Canaan Morse    |
>   |       |    24 | Lucas Klein     |
>   |       |    10 | Lucas Klein     |
>
> Then typing C-c C-x i and answering the wizard questions,
> we get a new table as follow:
>
>   #+BEGIN: aggregate :table "work" :cols "Translator sum(Chars) sum(Lines)"
>   | Translator      | sum(Chars) | sum(Lines) |
>
>   |-----------------+------------+------------|
>   | Austin Woerner  | NA         | 84         |
>   | Eric Abrahamsen | 6633       | NA         |
>   | Canaan Morse    | 16984      | NA         |
>   | Lucas Klein     | 2 NA       | 34         |
>   #+END:
>
> Whenever you change the "work" table,
> you can easily refresh the aggregated table by typing C-c C-c
>
> To install the orgtbl-aggregate module,
> add those lines to your .emacs:
>
>   (require 'package)
>   (add-to-list 'package-archives '("melpa" .
> "http://melpa.milkbox.net/packages/";) t)
>   (package-initialize)
>
> Then type M-x package-list-packages
> and install orgtbl-aggregate
>
> Have fun
> Thierry

Okay, having fun! This seems like exactly what I was after. A couple of
things:

I've attached a patch replacing some [a-z] regexps with [:word:], so
that column names can be written in scripts other than ascii (my tables
above are actually all in Chinese). I hope that's acceptable.

I've changed blank fields to "0" so that I don't get the "NA" strings.

Now I'd like to do more calculations based on the rows in the sum(Chars)
and sum(Lines) columns.

Ideally I could add a fourth column to the aggregate table, calculated
from rows in the previous two. Is there any way to make a column
specification that refers to columns in the same table? The fourth
column would be defined as:

(sum(prod($2 0.7) prod($3 10))

Where $2 and $3 refer to cells in the aggregated table.

I made that up -- I don't even know if it's valid calc syntax. But
that's the idea. Or perhaps I should be making a third table based on
this second one?

Thanks again!

Eric

Attachment: 0001-Modify-regexps-to-find-word-instead-of-a-zA-Z.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]