* problems with tables using https://orgmode.org/worg/org-tutorials/org-lookups.html
@ 2018-04-05 15:56 Uwe Brauer
2018-04-30 12:38 ` Nicolas Goaziou
0 siblings, 1 reply; 7+ messages in thread
From: Uwe Brauer @ 2018-04-05 15:56 UTC (permalink / raw)
To: emacs-orgmode
Hi
I followed the instructions in
https://orgmode.org/worg/org-tutorials/org-lookups.html
#+BEGIN_SRC emacs-lisp
(defun in-interval (bounds el)
(and (>= el (car bounds)) (<= el (cadr bounds))))
#+END_SRC
#+RESULTS:
: in-interval
And indeed
#+TBLNAME: raw-data
| | 4 |
| | 4.25 |
| | 4.5 |
| | 4.5 |
| | 5.5 |
| | 5.5 |
| | 5.5 |
| | 5.75 |
| | 6 |
| | 6.5 |
| | 7 |
| | 7.5 |
| | 9 |
| lower bound | upper bound | frequency |
|-------------+-------------+-----------|
| 1 | 5 | 3 |
| 5 | 10 | 9 |
#+TBLFM: $3='(length (org-lookup-all '($1 $2) '(remote(raw-data,@2$2..@>$2)) nil 'in-interval));N
Gives the desired result.
However consider the following (slightly more complicated table).
#+TBLNAME: raw-data2
|---+-----------------+-----+-----+-----+-----+-----+-----+-----|
| | / | | <> | <> | <> | <> | <> | <> |
| | Nombre Completo | DNI | Ej1 | Ej2 | Ej3 | Ej4 | Ej5 | Res |
|---+-----------------+-----+-----+-----+-----+-----+-----+-----|
| | Candidate1 | 1 | 0 | 5 | 5 | 0 | 10 | 2 |
| | Candidate2 | 2 | 5 | 0 | 5 | 0 | 0 | 1 |
| | Candidate3 | 3 | 0 | 0 | 0 | 20 | 25 | 4.5 |
| | Candidate4 | 4 | 0 | 0 | 0 | 25 | 15 | 4 |
| | Candidate5 | 5 | 15 | 15 | 20 | 25 | 25 | 10 |
| | Candidate6 | 6 | 15 | 10 | 20 | 20 | 20 | 8.5 |
| | Candidate7 | 7 | 15 | 10 | 10 | 20 | 15 | 7 |
#+TBLFM: $9=($4+$5+$6+$7+$8)/10
| lower bound | upper bound | frequency |
|-------------+-------------+-----------|
| 1 | 5 | 0 |
| 5 | 10 | 1 |
#+TBLFM: $3='(length (org-lookup-all '($1 $2) '(remote(raw-data2,@9$9..@>$9)) nil 'in-interval));N
And it does not work,
Also
#+TBLNAME: raw-data3
|---+-----------------+-----+-----+-----+-----+-----|
| | / | <> | <> | <> | <> | <> |
| | Nombre Completo | Ej1 | Ej2 | Ej3 | Ej4 | Res |
|---+-----------------+-----+-----+-----+-----+-----|
| | Candidate1 | 0 | 5 | 5 | 0 | 1 |
| | Candidate2 | 5 | 0 | 5 | 0 | 1 |
| | Candidate3 | 0 | 0 | 0 | 20 | 2 |
| | Candidate4 | 0 | 0 | | 25 | 2.5 |
| | Candidate5 | 15 | 15 | 20 | 25 | 7.5 |
| | Candidate6 | 15 | 10 | 20 | 20 | 6.5 |
| | Candidate7 | 15 | 0 | 10 | 20 | 4.5 |
#+TBLFM: $7=($3+$4+$5+$6)/10
| lower bound | upper bound | frequency |
|-------------+-------------+-----------|
| 0 | 5 | 1 |
| 5 | 10 | 2 |
#+TBLFM: $3='(length (org-lookup-all '($1 $2) '(remote(raw-data3,@7$7..@>$7)) nil 'in-interval));N
Does not work correctly?
What is the problem?
thanks
Uwe Brauer
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: problems with tables using https://orgmode.org/worg/org-tutorials/org-lookups.html
2018-04-05 15:56 problems with tables using https://orgmode.org/worg/org-tutorials/org-lookups.html Uwe Brauer
@ 2018-04-30 12:38 ` Nicolas Goaziou
2018-04-30 16:19 ` Uwe Brauer
0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2018-04-30 12:38 UTC (permalink / raw)
To: Uwe Brauer; +Cc: emacs-orgmode
Hello,
Uwe Brauer <oub@mat.ucm.es> writes:
> #+TBLNAME: raw-data2
Not related, but : #+name: raw-data2
> |---+-----------------+-----+-----+-----+-----+-----+-----+-----|
>
> | | / | | <> | <> | <> | <> | <> | <> |
> | | Nombre Completo | DNI | Ej1 | Ej2 | Ej3 | Ej4 | Ej5 | Res |
> |---+-----------------+-----+-----+-----+-----+-----+-----+-----|
> | | Candidate1 | 1 | 0 | 5 | 5 | 0 | 10 | 2 |
> | | Candidate2 | 2 | 5 | 0 | 5 | 0 | 0 | 1 |
> | | Candidate3 | 3 | 0 | 0 | 0 | 20 | 25 | 4.5 |
> | | Candidate4 | 4 | 0 | 0 | 0 | 25 | 15 | 4 |
> | | Candidate5 | 5 | 15 | 15 | 20 | 25 | 25 | 10 |
> | | Candidate6 | 6 | 15 | 10 | 20 | 20 | 20 | 8.5 |
> | | Candidate7 | 7 | 15 | 10 | 10 | 20 | 15 | 7 |
>
> #+TBLFM: $9=($4+$5+$6+$7+$8)/10
>
> | lower bound | upper bound | frequency |
> |-------------+-------------+-----------|
> | 1 | 5 | 0 |
> | 5 | 10 | 1 |
>
> #+TBLFM: $3='(length (org-lookup-all '($1 $2) '(remote(raw-data2,@9$9..@>$9)) nil 'in-interval));N
^^^^
@2$9
>
> #+TBLNAME: raw-data3
See above.
> |---+-----------------+-----+-----+-----+-----+-----|
>
> | | / | <> | <> | <> | <> | <> |
> | | Nombre Completo | Ej1 | Ej2 | Ej3 | Ej4 | Res |
> |---+-----------------+-----+-----+-----+-----+-----|
> | | Candidate1 | 0 | 5 | 5 | 0 | 1 |
> | | Candidate2 | 5 | 0 | 5 | 0 | 1 |
> | | Candidate3 | 0 | 0 | 0 | 20 | 2 |
> | | Candidate4 | 0 | 0 | | 25 | 2.5 |
> | | Candidate5 | 15 | 15 | 20 | 25 | 7.5 |
> | | Candidate6 | 15 | 10 | 20 | 20 | 6.5 |
> | | Candidate7 | 15 | 0 | 10 | 20 | 4.5 |
>
> #+TBLFM: $7=($3+$4+$5+$6)/10
>
> | lower bound | upper bound | frequency |
> |-------------+-------------+-----------|
> | 0 | 5 | 1 |
> | 5 | 10 | 2 |
>
> #+TBLFM: $3='(length (org-lookup-all '($1 $2) '(remote(raw-data3,@7$7..@>$7)) nil 'in-interval));N
^^^^
ditto
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: problems with tables using https://orgmode.org/worg/org-tutorials/org-lookups.html
2018-04-30 12:38 ` Nicolas Goaziou
@ 2018-04-30 16:19 ` Uwe Brauer
2018-04-30 17:51 ` Nicolas Goaziou
0 siblings, 1 reply; 7+ messages in thread
From: Uwe Brauer @ 2018-04-30 16:19 UTC (permalink / raw)
To: emacs-orgmode
Thanks!
Do you mean
#+begin_src org
#+name: raw-data2
|---+-----------------+-----+-----+-----+-----+-----+-----+-----|
| | / | | <> | <> | <> | <> | <> | <> |
| | Nombre Completo | DNI | Ej1 | Ej2 | Ej3 | Ej4 | Ej5 | Res |
|---+-----------------+-----+-----+-----+-----+-----+-----+-----|
| | Candidate1 | 1 | 0 | 5 | 5 | 0 | 10 | 2 |
| | Candidate2 | 2 | 5 | 0 | 5 | 0 | 0 | 1 |
| | Candidate3 | 3 | 0 | 0 | 0 | 20 | 25 | 4.5 |
| | Candidate4 | 4 | 0 | 0 | 0 | 25 | 15 | 4 |
| | Candidate5 | 5 | 15 | 15 | 20 | 25 | 25 | 10 |
| | Candidate6 | 6 | 15 | 10 | 20 | 20 | 20 | 8.5 |
| | Candidate7 | 7 | 15 | 10 | 10 | 20 | 15 | 7 |
#+TBLFM: $9=($4+$5+$6+$7+$8)/10
| lower bound | upper bound | frequency |
|-------------+-------------+-----------|
| 1 | 5 | #ERROR |
| 5 | 10 | #ERROR |
#+TBLFM: $3='(length (org-lookup-all '($1 $2) '(remote(raw-data2,@2$9..@>$9)) nil 'in-interval));N
#+end_src
That did not work neither as you can see.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: problems with tables using https://orgmode.org/worg/org-tutorials/org-lookups.html
2018-04-30 16:19 ` Uwe Brauer
@ 2018-04-30 17:51 ` Nicolas Goaziou
2018-05-01 9:20 ` Uwe Brauer
2018-05-01 9:53 ` [SOLVED] (was: problems with tables using https://orgmode.org/worg/org-tutorials/org-lookups.html) Uwe Brauer
0 siblings, 2 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2018-04-30 17:51 UTC (permalink / raw)
To: emacs-orgmode
Hello,
Uwe Brauer <oub@mat.ucm.es> writes:
> #+name: raw-data2
> |---+-----------------+-----+-----+-----+-----+-----+-----+-----|
> | | / | | <> | <> | <> | <> | <> | <> |
I also moved "/" to the left column. But it works without it.
> | | Nombre Completo | DNI | Ej1 | Ej2 | Ej3 | Ej4 | Ej5 | Res |
> |---+-----------------+-----+-----+-----+-----+-----+-----+-----|
> | | Candidate1 | 1 | 0 | 5 | 5 | 0 | 10 | 2 |
> | | Candidate2 | 2 | 5 | 0 | 5 | 0 | 0 | 1 |
> | | Candidate3 | 3 | 0 | 0 | 0 | 20 | 25 | 4.5 |
> | | Candidate4 | 4 | 0 | 0 | 0 | 25 | 15 | 4 |
> | | Candidate5 | 5 | 15 | 15 | 20 | 25 | 25 | 10 |
> | | Candidate6 | 6 | 15 | 10 | 20 | 20 | 20 | 8.5 |
> | | Candidate7 | 7 | 15 | 10 | 10 | 20 | 15 | 7 |
> #+TBLFM: $9=($4+$5+$6+$7+$8)/10
>
> | lower bound | upper bound | frequency |
> |-------------+-------------+-----------|
> | 1 | 5 | #ERROR |
> | 5 | 10 | #ERROR |
> #+TBLFM: $3='(length (org-lookup-all '($1 $2) '(remote(raw-data2,@2$9..@>$9)) nil 'in-interval));N
>
> #+end_src
>
>
>
> That did not work neither as you can see.
It definitely works here.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: problems with tables using https://orgmode.org/worg/org-tutorials/org-lookups.html
2018-04-30 17:51 ` Nicolas Goaziou
@ 2018-05-01 9:20 ` Uwe Brauer
2018-05-01 9:49 ` Nicolas Goaziou
2018-05-01 9:53 ` [SOLVED] (was: problems with tables using https://orgmode.org/worg/org-tutorials/org-lookups.html) Uwe Brauer
1 sibling, 1 reply; 7+ messages in thread
From: Uwe Brauer @ 2018-05-01 9:20 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1578 bytes --]
>>> "Nicolas" == Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
Since I am using a git version from July I just pulled the latest master
compiled and installed.
> It definitely works here.
Here is the table I consider
#+name: raw-data2
|---+-----------------+-----+-----+-----+-----+-----+-----+-----|
| | Nombre Completo | DNI | Ej1 | Ej2 | Ej3 | Ej4 | Ej5 | Res |
|---+-----------------+-----+-----+-----+-----+-----+-----+-----|
| | Candidate1 | 1 | 0 | 5 | 5 | 0 | 10 | 2 |
| | Candidate2 | 2 | 5 | 0 | 5 | 0 | 0 | 1 |
| | Candidate3 | 3 | 0 | 0 | 0 | 20 | 25 | 4.5 |
| | Candidate4 | 4 | 0 | 0 | 0 | 25 | 15 | 4 |
| | Candidate5 | 5 | 15 | 15 | 20 | 25 | 25 | 10 |
| | Candidate6 | 6 | 15 | 10 | 20 | 20 | 20 | 8.5 |
| | Candidate7 | 7 | 15 | 10 | 10 | 20 | 15 | 7 |
#+TBLFM: $9=($4+$5+$6+$7+$8)/10
| lower bound | upper bound | frequency |
|-------------+-------------+-----------|
| 1 | 5 | #ERROR |
| 5 | 10 | #ERROR |
#+TBLFM: $3='(length (org-lookup-all '($1 $2) '(remote(raw-data2,@2$9..@>$9)) nil 'in-interval));N
I put the cursor on #+TBLFM: $3='(length (org-lookup-all '($1 $2) '(remote(raw-data2,@2$9..@>$9)) nil 'in-interval));N
And run C-c C-c
I obtain an errror and the message
Cells in the region copied, use M-x org-table-paste-rectangle to paste them in a table. [2 times]
But when I run that command org does not present the frequencies I am
looking for, what do I miss?
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5025 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: problems with tables using https://orgmode.org/worg/org-tutorials/org-lookups.html
2018-05-01 9:20 ` Uwe Brauer
@ 2018-05-01 9:49 ` Nicolas Goaziou
0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2018-05-01 9:49 UTC (permalink / raw)
To: emacs-orgmode
Hello,
Uwe Brauer <oub@mat.ucm.es> writes:
> Here is the table I consider
>
> #+name: raw-data2
> |---+-----------------+-----+-----+-----+-----+-----+-----+-----|
>
> | | Nombre Completo | DNI | Ej1 | Ej2 | Ej3 | Ej4 | Ej5 | Res |
> |---+-----------------+-----+-----+-----+-----+-----+-----+-----|
> | | Candidate1 | 1 | 0 | 5 | 5 | 0 | 10 | 2 |
> | | Candidate2 | 2 | 5 | 0 | 5 | 0 | 0 | 1 |
> | | Candidate3 | 3 | 0 | 0 | 0 | 20 | 25 | 4.5 |
> | | Candidate4 | 4 | 0 | 0 | 0 | 25 | 15 | 4 |
> | | Candidate5 | 5 | 15 | 15 | 20 | 25 | 25 | 10 |
> | | Candidate6 | 6 | 15 | 10 | 20 | 20 | 20 | 8.5 |
> | | Candidate7 | 7 | 15 | 10 | 10 | 20 | 15 | 7 |
>
> #+TBLFM: $9=($4+$5+$6+$7+$8)/10
>
> | lower bound | upper bound | frequency |
> |-------------+-------------+-----------|
> | 1 | 5 | #ERROR |
> | 5 | 10 | #ERROR |
>
> #+TBLFM: $3='(length (org-lookup-all '($1 $2) '(remote(raw-data2,@2$9..@>$9)) nil 'in-interval));N
>
> I put the cursor on #+TBLFM: $3='(length (org-lookup-all '($1 $2) '(remote(raw-data2,@2$9..@>$9)) nil 'in-interval));N
>
> And run C-c C-c
> I obtain an errror and the message
I obtain:
| lower bound | upper bound | frequency |
|-------------+-------------+-----------|
| 1 | 5 | 4 |
| 5 | 10 | 3 |
#+TBLFM: $3='(length (org-lookup-all '($1 $2) '(remote(raw-data2,@2$9..@>$9)) nil 'in-interval));N
I have no explaination for the discrepancy.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 7+ messages in thread
* [SOLVED] (was: problems with tables using https://orgmode.org/worg/org-tutorials/org-lookups.html)
2018-04-30 17:51 ` Nicolas Goaziou
2018-05-01 9:20 ` Uwe Brauer
@ 2018-05-01 9:53 ` Uwe Brauer
1 sibling, 0 replies; 7+ messages in thread
From: Uwe Brauer @ 2018-05-01 9:53 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 256 bytes --]
>>> "Nicolas" == Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Hello,
> Uwe Brauer <oub@mat.ucm.es> writes:
> It definitely works here.
Sorry by bad, I did not eval the lisp command in-interval!
Now everything works as expected. Thanks!
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5025 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-05-01 9:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-05 15:56 problems with tables using https://orgmode.org/worg/org-tutorials/org-lookups.html Uwe Brauer
2018-04-30 12:38 ` Nicolas Goaziou
2018-04-30 16:19 ` Uwe Brauer
2018-04-30 17:51 ` Nicolas Goaziou
2018-05-01 9:20 ` Uwe Brauer
2018-05-01 9:49 ` Nicolas Goaziou
2018-05-01 9:53 ` [SOLVED] (was: problems with tables using https://orgmode.org/worg/org-tutorials/org-lookups.html) 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).