[Top][All Lists]

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

Re: return column from table as a column

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]

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

#+begin_src emacs-lisp :var data=s1[,3] :post to-column(lst=*this*)

To transform more than one column, the following idea may be useful

(defun rotate (list-of-lists)
  (apply #'mapcar #'list list-of-lists))


reply via email to

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