emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Dan Davison <dandavison7@gmail.com>
To: Gary <emacs-orgmode@garydjones.name>
Cc: emacs-orgmode@gnu.org
Subject: Re: Sorting table columns (*not* content)
Date: Mon, 01 Nov 2010 17:47:54 +0000	[thread overview]
Message-ID: <8739rlue9h.fsf@gmail.com> (raw)
In-Reply-To: <iamg4v$ehg$1@dough.gmane.org> (Gary's message of "Mon, 01 Nov 2010 14:42:55 +0100")

Gary <emacs-orgmode@garydjones.name> writes:

> Is there any way to sort the columns of a table, such that for example
>
> | Col 3 | Col 1 | Col 2 |
>
> can be converted to
>
> | Col 1 | Col 2 | Col 3 |
> |-------+-------+-------|
> | ...   | ...   | ...   |
>

I'd do this using an external language that has a matrix/table data type
with column indexing.

#+tblname: unsorted
| Col3 | Col1 | Col2 |
|------+------+------|
| c    | a    |    b |

#+source: sorted
#+begin_src R :var tab=unsorted :colnames yes
tab[,order(colnames(tab))]
#+end_src

#+results: sorted
| Col1 | Col2 | Col3 |
|------+------+------|
| a    | b    | c    |

Dan

> ?
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

  parent reply	other threads:[~2010-11-01 17:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-01 13:42 Sorting table columns (*not* content) Gary
2010-11-01 13:52 ` Jeff Horn
2010-11-01 14:15   ` Gary
2010-11-01 15:09     ` Jeff Horn
2010-11-01 19:44     ` Carsten Dominik
2010-11-02 11:05       ` Gary
2010-11-01 19:02   ` Christian Moe
2010-11-01 19:27     ` brian powell
2010-11-01 14:43 ` Juan Pechiar
2010-11-01 15:33   ` Gary
2010-11-01 15:39   ` brian powell
2010-11-01 17:47 ` Dan Davison [this message]
2010-11-01 18:44   ` brian powell
2010-11-02 11:03   ` Gary

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=8739rlue9h.fsf@gmail.com \
    --to=dandavison7@gmail.com \
    --cc=emacs-orgmode@garydjones.name \
    --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).