emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thierry Banel <tbanelwebmin@free.fr>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: table formula help...
Date: Mon, 08 Dec 2014 22:57:38 +0100	[thread overview]
Message-ID: <54861ED2.1060908@free.fr> (raw)
In-Reply-To: <CALn3zoja2+16+bXkSi9psyS1Lj0q-L7Q2xD+TJTYYsGfkkhvHg@mail.gmail.com>


Le 08/12/2014 19:02, Michael Brand a écrit :
>
> 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.

You instantly found the weakness of the current design!

> It would mean to remove the above "In an output cell, if the computed
> result is zero, it not output, leaving a blank cell. [...]".

I'm inclined to agree with you. Dropping the /zero output becomes blank/
feature would be the best short-term compromise.

>  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.".

Yes, this is the correct specification. Testing that *all* inputs are blank.
Unfortunately, implementing this is a lot of work, because we need to
create new data structures to remember whether input fields are blank.

> #+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?

Good idea. I'll do that.

> 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.

Yes.

> 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-*
>

Definitely interesting. Someone else has already bumped into the empty
cells thing.

> Michael

Thierry

  reply	other threads:[~2014-12-08 21:57 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-06  5:42 table formula help Eric Abrahamsen
2014-12-06  7:37 ` Thomas S. Dye
2014-12-06  8:05 ` Michael Brand
2014-12-06  8:32   ` Eric Abrahamsen
2014-12-06 22:49   ` Thierry Banel
2014-12-07  2:05     ` Eric Abrahamsen
2014-12-07  3:25     ` Eric Abrahamsen
2014-12-07  9:20       ` Thierry Banel
2014-12-07  9:40         ` Michael Brand
2014-12-07 10:02           ` Thierry Banel
2014-12-07 10:26             ` Michael Brand
2014-12-07 14:51               ` Thierry Banel
2014-12-07 16:13               ` Thierry Banel
2014-12-07 16:48                 ` Michael Brand
2014-12-08 21:12                   ` Thierry Banel
2014-12-08 22:32                     ` Thierry Banel
2014-12-10 21:08                       ` Michael Brand
2014-12-08  3:52             ` Eric Abrahamsen
2014-12-07  9:39       ` Michael Brand
2014-12-07  9:55         ` Thierry Banel
2014-12-07 21:57         ` Thierry Banel
2014-12-08 18:02           ` Michael Brand
2014-12-08 21:57             ` Thierry Banel [this message]
2014-12-09  5:54               ` Michael Brand
2014-12-09 18:12                 ` Thierry Banel
2014-12-09 19:01             ` Thierry Banel
2014-12-09 22:35               ` Thierry Banel
2014-12-10 21:06                 ` Michael Brand
2014-12-10 22:55                   ` Thierry Banel
2014-12-12 17:15                     ` Michael Brand
2014-12-12 21:04                       ` Thierry Banel
2014-12-13 18:27                         ` Michael Brand
2015-01-25 22:21       ` Thierry Banel
2015-01-26  2:48         ` Eric Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54861ED2.1060908@free.fr \
    --to=tbanelwebmin@free.fr \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).