From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: Sorting table columns (*not* content) Date: Mon, 01 Nov 2010 17:47:54 +0000 Message-ID: <8739rlue9h.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=52696 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCyVM-0006Th-Kt for emacs-orgmode@gnu.org; Mon, 01 Nov 2010 13:49:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PCyVJ-00036D-AX for emacs-orgmode@gnu.org; Mon, 01 Nov 2010 13:49:11 -0400 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:60419) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PCyVJ-00035d-30 for emacs-orgmode@gnu.org; Mon, 01 Nov 2010 13:49:09 -0400 In-Reply-To: (Gary's message of "Mon, 01 Nov 2010 14:42:55 +0100") 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: Gary Cc: emacs-orgmode@gnu.org Gary 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