[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 08:13:06 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 |
Le 19/06/2018 19:21, Uwe Brauer a écrit :
Hi
Take the following example
#+TBLNAME: data
| Name | Cual 1 |
|------+--------|
| A | NT |
| B | NT |
| C | MH |
| D | AP |
| E | MH |
| F | SS |
| G | NP |
| H | NP |
| I | NP |
| | NT |
| | AP |
| | AP |
| | AP |
| | AP |
| | SB |
#+TBLNAME: stat-final2
| | Frequency |
|----+-----------|
| SS | 1 |
| AP | 5 |
| NT | 3 |
| SB | 1 |
| MH | 2 |
| NP | 3 |
#+TBLFM: @>$2='(length (org-lookup-all "NP" '(remote(data,@2$2..@>I$2)) nil))::@>>$2='(length (org-lookup-all "MH" '(remote(data,@2$2..@>I$2)) nil))::@>>>$2='(length
(org-lookup-all "SB" '(remote(data,@2$2..@>I$2)) nil))::@>>>>$2='(length (org-lookup-all "NT" '(remote(data,@2$2..@>I$2)) nil))::@>>>>>$2='(length (org-lookup-all
"AP" '(remote(data,@2$2..@>I$2)) nil))::@>>>>>>$2='(length (org-lookup-all "SS" '(remote(data,@2$2..@>I$2)) nil))
Are there any rules to break this very long expression?
Thanks
Uwe Brauer
You may want to take a look at the orgtbl-aggregate package available on
Melpa.
#+BEGIN: aggregate :table "data" :cols "'Cual 1' count()"
| 'Cual 1' | count() |
|----------+---------|
| NT | 3 |
| MH | 2 |
| AP | 5 |
| SS | 1 |
| NP | 3 |
| SB | 1 |
#+END:
It features the count() function which computes frequency, but also sum,
mean, filtering and much more.
Documentation here: https://github.com/tbanel/orgaggregate
To gain access to the Melpa repository I have those settings in my
.emacs file:
(require 'package)
(setq package-enable-at-startup nil) ; To prevent initialising twice
(add-to-list 'package-archives '("gnu" .
"http://elpa.gnu.org/packages/" ) t)
(add-to-list 'package-archives '("melpa" .
"http://melpa.milkbox.net/packages/") t)
(package-initialize)
Have fun
Thierry
- [O] very long table calc expressions ?, Uwe Brauer, 2018/06/19
- Re: [O] very long table calc expressions ?,
Thierry Banel <=
- 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