[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] very long table calc expressions ?
From: |
Thierry Banel |
Subject: |
Re: [O] very long table calc expressions ? |
Date: |
Wed, 20 Jun 2018 20:28:04 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 |
Le 20/06/2018 11:09, Uwe Brauer a écrit :
> Le 19/06/2018 19:21, Uwe Brauer a écrit :
> You may want to take a look at the orgtbl-aggregate package available on
> Melpa.
Thanks very much. I have already installed that package but the example
presented in the documentation were too sophisticated for my purpose. May
I suggest to include this example in the documentation, because your
package is a real time saver!!
I included such an example (and added your name to the contributors list).
I take the opportunity to ask whether your package can also easily
deal with the following problem (which is very important to me and
drives my crazy)
Not easily. orgaggregate groups rows using equality, whereas you need to
group rows based on intervals (between 5 and 6.9 for example).
But you can prepare the data table with a new, computed column, telling
in which interval each value falls:
#+TBLNAME: raw-data
| Test | Interval |
|------+----------|
| 0 | SS |
| 1 | SS |
| 2 | SS |
| 3 | SS |
| 4 | SS |
| 5 | AP |
| 6 | AP |
| 7 | NT |
| 8 | NT |
| 9 | SB |
| | NP |
| | NP |
| | NP |
#+TBLFM: $2= "nan"="$1" ? string("NP") : 0<=$1 && $1<=4.9 ? string("SS")
: 5<=$1 && $1<=6.9 ? string("AP") : 7<=$1 && $1<=8.9 ? string("NT") :
9<=$1 && $1<=10 ? string("SB") : string("OTHER");E
And then orgaggregate can handle it:
#+BEGIN: aggregate :table "raw-data" :cols "Interval count()"
| Interval | count() |
|----------+---------|
| SS | 5 |
| AP | 2 |
| NT | 2 |
| SB | 1 |
| NP | 3 |
#+END:
#+TBLFM: $4='(length (org-lookup-all '($2 $3) '(remote(raw-data,@2$1..@>$1))
nil 'in-interval));N
However that function can not deal with empty strings (I could replace
the empty string by some string but then the function does not
distinguish between the string and 0). So I want that the entry NP
represents the counts of the empty strings: there are three in that column.
So can your package deal with this situation?
Thanks again
Uwe Brauer
I don't have a solution out of my hat. But I guess the problem you face
may originate from the remote() function. It filters out empty values.
However you can change this behavior using the ;E modifier.
| [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] |
#+TBLFM: $1=remote(raw-data,@2$1..@>$1)
| [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, nan, nan, nan] |
#+TBLFM: $1=remote(raw-data,@2$1..@>$1);E
Regards
Thierry
- [O] very long table calc expressions ?, Uwe Brauer, 2018/06/19
- Re: [O] very long table calc expressions ?, Bernt Hansen, 2018/06/21
- Re: [O] very long table calc expressions ?, Uwe Brauer, 2018/06/22
- Re: [O] very long table calc expressions ?, Bernt Hansen, 2018/06/22
- Re: [O] very long table calc expressions ?, Uwe Brauer, 2018/06/22
- Re: [O] very long table calc expressions ?, Jonathan Leech-Pepin, 2018/06/22
- Re: [O] very long table calc expressions ?, Uwe Brauer, 2018/06/22
- Re: [O] very long table calc expressions ?, Nick Dokos, 2018/06/22
- Re: [O] very long table calc expressions ?, Thierry Banel, 2018/06/22
- Re: [O] very long table calc expressions ?, Uwe Brauer, 2018/06/22