[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] table lookup combine remote: problems
From: |
Uwe Brauer |
Subject: |
[O] table lookup combine remote: problems |
Date: |
Sat, 16 Jun 2018 16:48:48 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
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" '(@address@hidden) 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,@address@hidden)) nil))
But this does not work.
Any help would be strongly appreciated.
Thanks
Uwe Brauer
- [O] table lookup combine remote: problems,
Uwe Brauer <=