From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Brand Subject: Re: Re: Can't import a remote reference to a whole column in orgtbl Date: Mon, 05 Apr 2010 20:26:16 +0200 Message-ID: <4BBA2B48.4080801@alumni.ethz.ch> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nyr04-0007mg-Vq for emacs-orgmode@gnu.org; Mon, 05 Apr 2010 14:26:17 -0400 Received: from [140.186.70.92] (port=38209 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nyr02-0007lK-Mc for emacs-orgmode@gnu.org; Mon, 05 Apr 2010 14:26:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nyr00-0007dI-Tf for emacs-orgmode@gnu.org; Mon, 05 Apr 2010 14:26:14 -0400 Received: from mail01.solnet.ch ([212.101.4.135]:60968) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nyr00-0007cw-KQ for emacs-orgmode@gnu.org; Mon, 05 Apr 2010 14:26:12 -0400 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: Org-Mode List Carsten Dominik wrote: > Sometimes I would like to rewrite the entire table editior for more > structural clarity in the sode, so that it would be easier to implement > more fancy stuff :-) Possibly one of these fancy things: Some time ago I thought about transposing a table. But only now I realized that there is no additional implementation required any more because it can be done with the new field coordinates in formulas, `@#' and `$#': For example to transpose this 4x7 table FOO #+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 | start with the following 7x4 table without any horizontal line and yet empty and then update the table with the TBLFM that simply takes the row number `@$#' from the column number `$#' and the column number `$@#' from the row number `@#' for each field. the transposed copy of FOO: | year | min | avg | max | | 2004 | 401 | 402 | 403 | | 2005 | 501 | 502 | 503 | | 2006 | 601 | 602 | 603 | | 2007 | 701 | 702 | 703 | | 2008 | 801 | 802 | 803 | | 2009 | 901 | 902 | 903 | #+TBLFM: $1 = remote(FOO, @$#$@#) :: $2 = remote(FOO, @$#$@#) :: $3 = remote(FOO, @$#$@#) :: $4 = remote(FOO, @$#$@#) Possible field formulas from the remote table will have to be transferred manually. Since there are no row formulas yet to be transferred to column formulas or vice versa there is not much need yet to transfer formulas automatically. There could be a hint in the doc somehow like in the following patch. I didn't understand why the `must have at least as many' but anyhow tried to precise, so please check. ====================================================================== --- a/doc/org.texi +++ b/doc/org.texi @@ -2065,14 +2065,19 @@ and @code{org-table-current-column}. Ex @example if(@@# % 2, $#, string("")) @r{column number on odd lines only} -$3 = remote(FOO, @@@@#$2) @r{copy column 2 from table FOO into} - @r{column 3 of the current table} +$3 = remote(FOO, @@@@#$2) @r{copy column 2 from table FOO} + @r{into column 3 of the current table} +$1 = remote(FOO, @@$#$@@#) @r{copy row 1 from table FOO transposed} + @r{into column 1 of the current table} @end example -@noindent For the second example, table FOO must have at least as many rows -as the current table. Inefficient@footnote{The computation time scales as -O(N^2) because table FOO is parsed for each field to be copied.} for large -number of rows. +@noindent For the second example, table FOO should have at least as many rows +as the current table to avoid orphaned fields. Inefficient@footnote{The +computation time scales as O(N^2) because table FOO is parsed for each field +to be copied.} for large number of rows. For the third example, table FOO +should have at least as many columns as the current table has rows to avoid +orphaned fields. By applying this column formula to each column an entire +table can be transposed. Inefficient in the same way as the second example. @subsubheading Named references @cindex named references --- a/ORGWEBPAGE/Changes.org +++ b/ORGWEBPAGE/Changes.org @@ -437,8 +437,10 @@ respectively. These can be useful in so example, to sequentially number the fields in a column, use ~=@#~ as column equation. -One application is to copy a column from a different table. See -the manual for details. +Other applications are to copy a column from a different table to a +column, to copy a row from a different table transposed to a column +or to copy an entire table while transposing it. See the manual for +details. Thanks to Michael Brand for this feature. ======================================================================