From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: [Orgmode] Re: Can't import a remote reference to a whole column in orgtbl Date: Tue, 01 Nov 2011 17:14:45 -0400 Message-ID: <8038.1320182085@alphaville.americas.hpqcorp.net> References: <82e274891002251643k327135aajea270914244abff7@mail.gmail.com> <82e274891002251654s643e8003pdb2b3db669d5528b@mail.gmail.com> <83d3zs8hya.fsf@yahoo.it> <789851DE-3D35-4623-AB0A-E4168A5A178E@gmail.com> <4BB8E250.8090404@alumni.ethz.ch> <77A0A719-665A-493B-9FFA-7FC17F7EA485@gmail.com> <4BB97F0C.6080009@alumni.ethz.ch> <4BBA2B48.4080801@alumni.ethz.ch> <78F3D228-8E40-49AC-A58C-510AB9031203@gmail.com> <4BBCE315.5020200@alumni.ethz.ch> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([140.186.70.92]:60408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLLfV-0000e5-7r for emacs-orgmode@gnu.org; Tue, 01 Nov 2011 17:14:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RLLfT-0000ii-Pt for emacs-orgmode@gnu.org; Tue, 01 Nov 2011 17:14:49 -0400 Received: from g4t0017.houston.hp.com ([15.201.24.20]:26187) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLLfT-0000hu-Cl for emacs-orgmode@gnu.org; Tue, 01 Nov 2011 17:14:47 -0400 In-Reply-To: Message from Michael Brand of "Wed, 07 Apr 2010 21:55:01 +0200." <4BBCE315.5020200@alumni.ethz.ch> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Michael Brand Cc: nicholas.dokos@hp.com, Org-Mode List , Carsten Dominik Michael Brand wrote: > Carsten Dominik wrote: > > this is neat, but still kind of hard to do, because you have to put > > all these formulas there by hand. I am skipping this for the manual > > - maybe you'd like to put this into org-hacks, or into the FAQ on > > Worg? > > Ok, I have put it into Worg org-hacks.org: > http://orgmode.org/worg/org-hacks.php > in the section `Field coordinates in formulas', currently with this numbering > http://orgmode.org/worg/org-hacks.php#sec-17.2 > > And only now I have seen and answered this thread: > `feature request: transpose a table' > started here > http://thread.gmane.org/gmane.emacs.orgmode/17453 > and continued here > http://thread.gmane.org/gmane.emacs.orgmode/23809 > Since this is a reply to an old thread, let me set some context: there was a flurry of activity about transposing a table about 1.5 years ago - in addition to the two threads above, there was http://thread.gmane.org/gmane.emacs.orgmode/22610 http://thread.gmane.org/gmane.emacs.orgmode/22930 The latter contains a patch by Michael Brand that introduced "field coordinates" that got incorporated into org. That allowed Michael to do a table transposition that he also added to org-hacks (but the section number has changed - it is at http://orgmode.org/worg/org-hacks.html#sec-1-3-5 currently). There were various other solutions too using lisp (by Tom Dye and Juan Pechiar: iiuc, both of these were based on library-of-babel code), that might be more efficient than Michael's solution (Carsten warns explicitly about the inefficiency somewhere). But Michael's solution is clever: the idea is to create an empty table of the right dimensions, delete any separator lines manually and then apply a sequence of (identical) formulas, one for each column in the destination table, that populates the column from the corresponding row of the source table, then add separator lines back manually. To simplify the discussion, here's an example without separators: #+TBLNAME: FOO | year | 2004 | 2005 | 2006 | 2007 | 2008 | 2009 | | min | 401 | 501 | 601 | 701 | 801 | 901 | | avg | 402 | 502 | 602 | 702 | 802 | 902 | | max | 403 | 503 | 603 | 703 | 803 | 903 | So create a 7x4 table: M-x org-table-create RET 4x7 RET [fn:1] delete the separator, and apply the formulas: | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #+TBLFM: $1 = remote(FOO, @$#$@#) :: $2 = remote(FOO, @$#$@#) :: $3 = remote(FOO, @$#$@#) :: $4 = remote(FOO, @$#$@#) :: Footnotes: [fn:1] Note the order - not sure why org-table-create wants the dimensions in the "opposite" order.