emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Re: Sorting table columns (*not* content)


From: Dan Davison
Subject: [Orgmode] Re: Sorting table columns (*not* content)
Date: Mon, 01 Nov 2010 17:47:54 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Gary <address@hidden> 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.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode



reply via email to

[Prev in Thread] Current Thread [Next in Thread]