emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [babel] problem with colnames


From: Thomas S. Dye
Subject: Re: [O] [babel] problem with colnames
Date: Tue, 08 May 2012 09:16:08 -1000

Aloha Andreas,

Andreas Leha <address@hidden> 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?

I don't think this is possible with the current ob-r.el.  I found this
problem a few months ago and have been working around it since then.  I
think the solution is to patch ob-r.el so the :colnames header argument
has 4 states: none, input, output, both.  

All the best,
Tom

>
>
> 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
>
>
>

-- 
Thomas S. Dye
http://www.tsdye.com



reply via email to

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