emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Juan Manuel Macías" <maciaschain@posteo.net>
To: Roger Mason <rmason@mun.ca>
Cc: orgmode <emacs-orgmode@gnu.org>
Subject: Re: return column from table as a column
Date: Fri, 13 Aug 2021 14:47:05 +0000	[thread overview]
Message-ID: <87czqhieqe.fsf@posteo.net> (raw)
In-Reply-To: <y655yw9mnse.fsf@mun.ca> (Roger Mason's message of "Fri, 13 Aug 2021 11:47:53 -0230")

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



  parent reply	other threads:[~2021-08-13 14:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13 14:17 return column from table as a column Roger Mason
2021-08-13 14:30 ` Greg Minshall
2021-08-13 16:24   ` Roger Mason
2021-08-13 18:47   ` Greg Minshall
2021-08-13 14:47 ` Juan Manuel Macías [this message]
2021-08-13 16:32   ` Roger Mason
2021-08-13 17:12     ` Juan Manuel Macías
2021-08-14 10:30       ` Roger Mason
2021-08-14 12:10 ` Maxim Nikulin
2021-08-17 20:42   ` Roger Mason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87czqhieqe.fsf@posteo.net \
    --to=maciaschain@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=rmason@mun.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).