emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: return column from table as a column


From: Juan Manuel Macías
Subject: Re: return column from table as a column
Date: Fri, 13 Aug 2021 14:47:05 +0000

Hi Roger,

It's a dirty solution, but you can try:

#+name: s1
| scale |  scale1 |   scale3 |  jid |
| -     | 1.00402 | 0.952329 | 1632 |
| -     | 1.00402 | 0.962247 | 1633 |

#+begin_src emacs-lisp :var data=s1 col=3
    (let* ((column (mapcar (lambda (r) (format "%s" (nth col r))) data)))
           (mapcar 'list column))
#+end_src

#+RESULTS:
|  jid |
| 1632 |
| 1633 |

Best regards,

Juan Manuel 

Roger Mason writes:

> Hello,
>
> I need to extract a column from a table to use as input to a source
> block.  I want the extracted column to be returned as a column but it is
> returned as a row.  The following illustrates the problem:
>
> #+name: s1
> | scale |  scale1 |   scale3 |  jid |
>
> | -     | 1.00402 | 0.952329 | 1632 |
> | -     | 1.00402 | 0.962247 | 1633 |
>
> #+begin_src emacs-lisp :var data=s1[,3]
> data
> #+end_src
>
> #+RESULTS:
> | jid | 1632 | 1633 |
>
> I want:
>
> |  jid |
> | 1632 |
> | 1633 |
>
> Is there some means of changing 'data=s1[,3]' to accomplish this?
>
> Thanks,
> Roger
>
> GNU Emacs 27.2 (build 1, amd64-portbld-freebsd11.4, X toolkit, cairo
> version 1.16.0, Xaw3d scroll bars)
>
> Org mode version 9.2.3 (release_9.2.3-390-gfb5091 @
> /home/rmason/.emacs.d/org-git/lisp/)
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]