From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 2JjwNOayF2Gj4gAAgWs5BA (envelope-from ) for ; Sat, 14 Aug 2021 14:11:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 2PykMOayF2H2ZgAAB5/wlQ (envelope-from ) for ; Sat, 14 Aug 2021 12:11:18 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2B9D13F1BF for ; Sat, 14 Aug 2021 14:11:18 +0200 (CEST) Received: from localhost ([::1]:46866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mEsVQ-0004if-Bd for larch@yhetil.org; Sat, 14 Aug 2021 08:11:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54112) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mEsUk-0004g7-1o for emacs-orgmode@gnu.org; Sat, 14 Aug 2021 08:10:34 -0400 Received: from ciao.gmane.io ([116.202.254.214]:58860) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mEsUh-0004Eu-PG for emacs-orgmode@gnu.org; Sat, 14 Aug 2021 08:10:33 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1mEsUf-0002iB-1v for emacs-orgmode@gnu.org; Sat, 14 Aug 2021 14:10:29 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Maxim Nikulin Subject: Re: return column from table as a column Date: Sat, 14 Aug 2021 19:10:14 +0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 28 X-Spam_score: 2.8 X-Spam_bar: ++ X-Spam_report: (2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-0.001, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1628943078; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=2+6tDiTZpT8huqXER4N8bqkAWaFkYDyPxxHFuN/QtzA=; b=H6PUfjNk+NZ8WDfJLRZFkuTiSRA8CHitpUNClks/tXqoBlBJwm6VZrm183zt7Z8DBVqusc GvLr514y8q39GNSyIQDUDkfTLREpIUODktbdWFAESefUerFxX0pAwhTL7yPMSnTsFT3K2P l/JIfx1TNyj3N6vY70n6cvCzvD0GMTZJQ+8WWs/unuzPpmpLeUUJclepZ4s8qB+kVTQfWb 0Tqamaul9mA/6Pm+TJfkGLAQJT5SnCabozRVG9WzaE7hVl9OMDncF4udHsS7wyX/vBoI6j fz6CucVzGKobvneGlk2wcvsB38HPRBySsFw/zxFze60Vd8Ib4l7Ljwp7SKep2w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1628943078; a=rsa-sha256; cv=none; b=kTsR/4ghTavCkVYeIxRS5sKdqDQVKG6OKCa1kkJn35OLfsv1tSfCBMzUb93wW01T5gMxNH YFxVp9sDfXvBfeJg1+xKFtPAUhWd987+UXr5gaveu3fQiLkSKyFQburSIiFBkJ0cSlW/lq ukQH4Q7KVaum5Z6Ywow5rzsr6d48+yqKDJ33MKjRQgNaIqTTq/3QCCAGeZRlp6mdBNFK0K AbHLxoKkqmyFfoXzFTTn1kinf82hMMiVSv9auo9UXCToJM6oBe4mNIi11xxQUlNnjiEO55 UGhQdej8iVMyeWQKK+5qrDbT8OTpfk/dmfRYxR1NtlPlvNTWzH8f//o5jHBaOg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.81 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 2B9D13F1BF X-Spam-Score: -1.81 X-Migadu-Scanner: scn0.migadu.com X-TUID: 9I/16eO4B+0H 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