From: Uwe Brauer <oub@mat.ucm.es>
To: emacs-orgmode@gnu.org
Subject: table lookup combine remote: problems
Date: Sat, 16 Jun 2018 16:48:48 +0200 [thread overview]
Message-ID: <87d0wq6b3j.fsf@mat.ucm.es> (raw)
Hello
The following works
#+TBLNAME: raw-data2
| | Result |
|--------+--------|
| | 0.5 |
| | 1.5 |
| | 2.5 |
| | 3.5 |
| | 4 |
| | 7 |
| | 7.5 |
| | NP |
| | NP |
|--------+--------|
| All:NP | 2 |
#+TBLFM: @>$2='(length(org-lookup-all "NP" '(@2$2..@-I$2) nil))
The entries NP in the second column are counted and the result is put in
the last row.
I also want to the frequency (in a certain range) in the table, but I
want the result in a different table, that is why I need the remote
function
Auxiliary function from the web.
#+BEGIN_SRC emacs-lisp
(defun in-interval (bounds el)
(and (>= el (car bounds)) (<= el (cadr bounds))))
#+END_SRC
| lower bound | upper bound | frequency |
|-------------+-------------+-----------|
| 0.1 | 4.9 | 5 |
| 5 | 6.9 | 0 |
| 7 | 8.9 | 2 |
| 9 | 10 | 0 |
#+TBLFM: $3='(length (org-lookup-all '($1 $2) '(remote(raw-data2,@2$1..@>$1)) nil 'in-interval));N
Works.
Now I want to combine the first org-lookup with the second one and have
the result in a different table
so I tried
| lower bound | upper bound | frequency |
|-------------+-------------+-----------|
| 0.1 | 4.9 | 0 |
| 5 | 6.9 | 0 |
| 7 | 8.9 | 0 |
| 9 | 10 | 0 |
|-------------+-------------+-----------|
| | | 1 |
#+TBLFM: $3='(length (org-lookup-all '($1 $2) '(remote(raw-data2,@2$1..@>$1)) nil 'in-interval));N::@>$2='(length(org-lookup-all "NP" '(remote(raw-data2,@2$2..@-I$2)) nil))
But this does not work.
Any help would be strongly appreciated.
Thanks
Uwe Brauer
next reply other threads:[~2018-06-16 14:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-16 14:48 Uwe Brauer [this message]
2018-06-18 7:07 ` [Solution?] (was: table lookup combine remote: problems) 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=87d0wq6b3j.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).