|
From: | Maxim Nikulin |
Subject: | Re: return column from table as a column |
Date: | Sat, 14 Aug 2021 19:10:14 +0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 |
On 13/08/2021 21:17, Roger Mason wrote:
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?
Notice that you can get vertical representation of results as a list #+begin_src emacs-lisp :results list The following is a variation of a recipe suggested by Juan Manuel: #+name: to-column #+begin_src emacs-lisp :var lst=() (mapcar #'list lst) #+end_src #+begin_src emacs-lisp :var data=s1[,3] :post to-column(lst=*this*) data #+end_src To transform more than one column, the following idea may be useful (defun rotate (list-of-lists) (apply #'mapcar #'list list-of-lists)) https://stackoverflow.com/questions/3513128/transposing-lists-in-common-lisp
[Prev in Thread] | Current Thread | [Next in Thread] |