From: Uwe Brauer <oub@mat.ucm.es>
To: emacs-orgmode@gnu.org
Subject: Re: very long table calc expressions ?
Date: Wed, 20 Jun 2018 11:09:19 +0200 [thread overview]
Message-ID: <87fu1h25a8.fsf@mat.ucm.es> (raw)
In-Reply-To: 5B29F072.4040805@free.fr
[-- Attachment #1: Type: text/plain, Size: 2482 bytes --]
> 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.
> #+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
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 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)
Take the following table
#+TBLNAME: raw-data
| Test |
|------|
| 0 |
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
| |
| |
| |
Important are the last three empty strings.
I know, thanks to the
https://orgmode.org/worg/org-tutorials/org-lookups.html
how to count the frequencies of the numbers in the column in an interval using the
function
#+TBLNAME: stat-table
#+ATTR_HTML: :border 2 :rules all :frame border
| | lower bound | upper bound | frequency |
|----+-------------+-------------+-----------|
| NP | 0 | 0 | 1 |
| SS | 0 | 4.9 | 5 |
| AP | 5 | 6.9 | 2 |
| NT | 7 | 8.9 | 2 |
| SB | 9 | 10 | 1 |
#+TBLFM: $4='(length (org-lookup-all '($2 $3) '(remote(raw-data,@2$1..@>$1)) nil 'in-interval));N
#+BEGIN_SRC emacs-lisp
(defun in-interval (bounds el)
(and (>= el (car bounds)) (<= el (cadr bounds))))
#+END_SRC
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
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5025 bytes --]
next prev parent reply other threads:[~2018-06-20 9:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-19 17:21 very long table calc expressions ? Uwe Brauer
2018-06-20 6:13 ` Thierry Banel
2018-06-20 9:09 ` Uwe Brauer [this message]
2018-06-20 18:28 ` Thierry Banel
2018-06-21 13:35 ` Uwe Brauer
2018-06-21 19:06 ` Bernt Hansen
2018-06-22 10:28 ` Uwe Brauer
2018-06-22 13:16 ` Bernt Hansen
2018-06-22 14:16 ` Uwe Brauer
2018-06-22 15:03 ` Jonathan Leech-Pepin
2018-06-22 15:25 ` Uwe Brauer
2018-06-22 16:48 ` Nick Dokos
2018-06-22 17:22 ` Thierry Banel
2018-06-22 17:54 ` Uwe Brauer
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=87fu1h25a8.fsf@mat.ucm.es \
--to=oub@mat.ucm.es \
--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).