emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Bug passing tables to R code blocks?


From: Thomas S. Dye
Subject: Re: [O] Bug passing tables to R code blocks?
Date: Tue, 18 Oct 2011 08:44:31 -1000

Eric Schulte <address@hidden> writes:

> Nick Dokos <address@hidden> writes:
>
>> Thomas S. Dye <address@hidden> wrote:
>>
>>> Aloha all,
>>> 
>>> I'm seeing some unexpected behavior when passing two tables into an R
>>> source code block.  Things seem to work as expected when only one table is
>>> passed. 
>>> 
>>> In the following example, the header for the second table ends up on the
>>> first table when I evaluate the source code block.
>>> 
>>> * R tables
>>> 
>>> #+TBLNAME: tbl-1
>>> | column1 | column2 |
>>> |---------+---------|
>>> |      45 |      34 |
>>> |      77 |      56 |
>>> 
>>> #+tblname: tbl-2
>>> | col1 | col2 |
>>> |------+------|
>>> | a    | b    |
>>> | c    | d    |
>>> 
>>> #+BEGIN_SRC R :var x=tbl-1 :var y=tbl-2 :colnames yes
>>> x
>>> #+END_SRC
>>> 
>>> #+results:
>>> | col1 | col2 |
>>> |------+------|
>>> |   45 |   34 |
>>> |   77 |   56 |
>>> 
>>> release_7.7-396-g3538
>>> Org-mode version 7.7 (release_7.7.396.g3538)
>>> 
>>> Bug?  Or my setup?
>>> 
>>
>> Bug, I think: org-babel-disassemble-tables goes over tables from left to
>> right (top to bottom) but conses colnames (and rownames) to the front,
>> so they come out backwards. Reversing those two lists just before
>> org-babel-disassemble-tables returns should fix it.
>>
>
> Nick, thanks for diagnosing this problem your fix worked exactly as
> expected and I have just pushed it up to the Org-mode repository.
>
> Best -- Eric
>
>>
>> Nick
>>
>>
>>
Thanks Eric and Nick,

This fixes the problem I was seeing.

All the best,
Tom
-- 
Thomas S. Dye
http://www.tsdye.com



reply via email to

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