emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] table formula help...


From: Michael Brand
Subject: Re: [O] table formula help...
Date: Mon, 8 Dec 2014 19:02:53 +0100

Hi Thierry

On Sun, Dec 7, 2014 at 10:57 PM, Thierry Banel <address@hidden> wrote:
> Done.
> Probably this can be discussed further.

I hope that there are more opinions than only mine.

> For the time being, there is no longer any "NA".

Good. My opinion is about to replace it with what.

https://github.com/tbanel/orgaggregate#empty-and-malformed-input-cells
says:

    An input cell may be empty. In this case, it is silently replaced
    by zero. In an output cell, if the computed result is zero, it not
    output, leaving a blank cell. This allows for empty input cells to
    result in empty output cells.

I understand the intention very well (the proof is in the references
at the bottom ;-) ). Nevertheless I find the compromise goes too far
when in the following example the sum and mean for a0 and b0 are
empty. I would prefer 0 there even when for the time being it is at
the cost of that c results in a sum and mean of 0 too.

It would mean to remove the above "In an output cell, if the computed
result is zero, it not output, leaving a blank cell. [...]". Or - when
you want to bother with the implementation - to change it into "If all
input cells of a computation are empty then the result cell is left
empty.".

#+TBLNAME: original
| Item | Value |
|------+-------|
| a2   |     1 |
| a2   |     1 |
| a0   |    -1 |
| a0   |     1 |
| b2   |     2 |
| b2   |       |
| b0   |     0 |
| b0   |       |
| c    |       |
| c    |       |

#+BEGIN: aggregate :table original :cols "Item sum(Value) mean(Value)"
| Item | sum(Value) | mean(Value) |
|------+------------+-------------|
| a2   |          2 |           1 |
| a0   |            |             |
| b2   |          2 |           1 |
| b0   |            |             |
| c    |            |             |
#+END

Could you please add this example or something in the same sense to
the unittests.org before any other change?

https://github.com/tbanel/orgaggregate#empty-and-malformed-input-cells
continues:

    The empty cell handling may be changed in the futur. For instance,
    we may want to compute an average aggregation ignoring empty cells
    (right now, empty cells contribute to the average by pulling it
    toward zero).

As I understand orgaggregate already uses Calc vectors. Maybe then it
could use and benefit from org-table-make-reference which has the
necessary arguments and asks for a Lisp list? See
testing/lisp/test-org-table.el:
- The application of the mode string variations for TBLFM are in
  test-org-table/references/mode-string-*.
- The same variations for org-table-make-reference are in
  test-org-table/org-table-make-reference/mode-string-*

Michael



reply via email to

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