From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: Re: [babel] problem with colnames Date: Tue, 08 May 2012 22:26:52 +0200 Message-ID: <87aa1i2zcj.fsf@med.uni-goettingen.de> References: <87r4uu33ks.fsf@med.uni-goettingen.de> <877gwmimib.fsf@gmx.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:60245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRr2y-0005el-DQ for emacs-orgmode@gnu.org; Tue, 08 May 2012 16:30:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SRr2w-0006WW-9I for emacs-orgmode@gnu.org; Tue, 08 May 2012 16:30:11 -0400 Received: from plane.gmane.org ([80.91.229.3]:60737) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRr2w-0006WA-24 for emacs-orgmode@gnu.org; Tue, 08 May 2012 16:30:10 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1SRr2p-0004ox-8M for emacs-orgmode@gnu.org; Tue, 08 May 2012 22:30:03 +0200 Received: from vpn-2130.gwdg.de ([134.76.2.130]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 08 May 2012 22:30:03 +0200 Received: from andreas.leha by vpn-2130.gwdg.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 08 May 2012 22:30:03 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Eric Schulte writes: > Andreas Leha writes: > >> Hi all, >> >> I have a question regarding colnames in babel source blocks. >> >> Suppose, I have a source block (in R) that has as input a table and returns a >> table. And I would like to have the resulting table with column >> names, but the input table does not have column names. >> >> How can I achieve this? >> >> >> Here is an example: >> >> The input table >> >> #+name: intab >> | bla | >> | blu | >> >> >> By default, the colnames are stripped off the result: >> >> #+begin_src R :var intab=intab >> colnames(intab) <- "rara" >> >> intab >> #+end_src >> >> #+results: >> | bla | >> | blu | >> >> >> The same happens when setting :colnames no >> >> #+begin_src R :var intab=intab :colnames no >> colnames(intab) <- "rara" >> >> intab >> #+end_src >> >> #+results: >> | bla | >> | blu | >> >> >> Setting :colnames yes strips the first row from the input: >> >> #+begin_src R :var intab=intab :colnames yes >> colnames(intab) <- "rara" >> >> intab >> #+end_src >> >> #+results: >> | rara | >> |------| >> | blu | >> >> >> Finally, setting :colnames nil also strips the first row from the input: >> >> #+begin_src R :var intab=intab :colnames nil >> colnames(intab) <- "rara" >> >> intab >> #+end_src >> >> #+results: >> | rara | >> |------| >> | blu | >> >> >> Regards, >> Andreas >> >> > > It almost seems like there should be two columnames options, one for > input and one for output. This would add complexity but would make use > cases like yours above feasible. > > Does this sound reasonable? Definitely. Just as Tom also suggested. I would very much welcome such new feature. Regards, Andreas