emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* table lookup combine remote: problems
@ 2018-06-16 14:48 Uwe Brauer
  2018-06-18  7:07 ` [Solution?] (was: table lookup combine remote: problems) Uwe Brauer
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Brauer @ 2018-06-16 14:48 UTC (permalink / raw)
  To: emacs-orgmode

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 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Solution?] (was: table lookup combine remote: problems)
  2018-06-16 14:48 table lookup combine remote: problems Uwe Brauer
@ 2018-06-18  7:07 ` Uwe Brauer
  0 siblings, 0 replies; 2+ messages in thread
From: Uwe Brauer @ 2018-06-18  7:07 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1122 bytes --]

>>> "Uwe" == Uwe Brauer <oub@mat.ucm.es> writes:

It seems that the following works.

#+TBLNAME: raw-data
|-------+--------+-------+------------|
| First | Second | Third | Forth      |
|-------+--------+-------+------------|
|    NP | NP     |    NP |         NP |
|    NP | NP     |    NP |         NP |
|   3.5 | NP     |    NP |        2.8 |
|    NP | NP     |    NP |         NP |
|   2.5 | 3.25   |   7.7 |        3.5 |
|     4 | NP     |   4.5 |        3.7 |
|    NP | NP     |    NP |         NP |
|-------+--------+-------+------------|





#+TBLNAME: stat-marco
#+ATTR_HTML: :border 2 :rules all :frame border
|    | lower bound | upper bound | frequency |
|----+-------------+-------------+-----------|
| SS |         0.1 |         4.9 |         1 |
| AP |           5 |         6.9 |         0 |
| NT |           7 |         8.9 |         1 |
| SB |           9 |          10 |         0 |
| NP |             |             |         5 |
#+TBLFM: $4='(length (org-lookup-all '($2 $3) '(remote(raw-data,@2$3..@>$3)) nil 'in-interval));N::@>$4='(length(org-lookup-all "NP" '(remote(raw-data,(@2$3..@>$3)) nil)))

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5025 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-18  7:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-16 14:48 table lookup combine remote: problems Uwe Brauer
2018-06-18  7:07 ` [Solution?] (was: table lookup combine remote: problems) Uwe Brauer

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).