From: Michael Brand <michael.brand@alumni.ethz.ch>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: Org-Mode List <emacs-orgmode@gnu.org>
Subject: Re: Re: Can't import a remote reference to a whole column in orgtbl
Date: Mon, 05 Apr 2010 20:26:16 +0200 [thread overview]
Message-ID: <4BBA2B48.4080801@alumni.ethz.ch> (raw)
In-Reply-To: <A24E4974-9234-4B14-BFEF-D8E3BE22877B@gmail.com>
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.
======================================================================
next prev parent reply other threads:[~2010-04-05 18:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-26 0:43 Can't import a remote reference to a whole column in orgtbl Ismael Barros²
2010-02-26 0:54 ` Ismael Barros²
2010-02-26 9:27 ` Giovanni Ridolfi
2010-04-03 17:24 ` Ismael Barros²
2010-04-04 6:47 ` Carsten Dominik
2010-04-04 19:02 ` Michael Brand
2010-04-04 20:08 ` Carsten Dominik
2010-04-05 6:11 ` Michael Brand
2010-04-05 6:48 ` Carsten Dominik
2010-04-05 18:26 ` Michael Brand [this message]
2010-04-06 5:15 ` Carsten Dominik
2010-04-07 19:55 ` Michael Brand
2011-11-01 21:14 ` [Orgmode] " Nick Dokos
2011-11-01 21:23 ` Nick Dokos
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=4BBA2B48.4080801@alumni.ethz.ch \
--to=michael.brand@alumni.ethz.ch \
--cc=carsten.dominik@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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).