* Bug passing tables to R code blocks?
@ 2011-10-18 2:05 Thomas S. Dye
2011-10-18 2:45 ` Nick Dokos
0 siblings, 1 reply; 4+ messages in thread
From: Thomas S. Dye @ 2011-10-18 2:05 UTC (permalink / raw)
To: Org-mode
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?
All the best,
Tom
--
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug passing tables to R code blocks?
2011-10-18 2:05 Bug passing tables to R code blocks? Thomas S. Dye
@ 2011-10-18 2:45 ` Nick Dokos
2011-10-18 16:09 ` Eric Schulte
0 siblings, 1 reply; 4+ messages in thread
From: Nick Dokos @ 2011-10-18 2:45 UTC (permalink / raw)
To: Thomas S. Dye; +Cc: nicholas.dokos, Org-mode
Thomas S. Dye <tsd@tsdye.com> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug passing tables to R code blocks?
2011-10-18 2:45 ` Nick Dokos
@ 2011-10-18 16:09 ` Eric Schulte
2011-10-18 18:44 ` Thomas S. Dye
0 siblings, 1 reply; 4+ messages in thread
From: Eric Schulte @ 2011-10-18 16:09 UTC (permalink / raw)
To: nicholas.dokos; +Cc: Org-mode
Nick Dokos <nicholas.dokos@hp.com> writes:
> Thomas S. Dye <tsd@tsdye.com> 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
>
>
>
--
Eric Schulte
http://cs.unm.edu/~eschulte/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Bug passing tables to R code blocks?
2011-10-18 16:09 ` Eric Schulte
@ 2011-10-18 18:44 ` Thomas S. Dye
0 siblings, 0 replies; 4+ messages in thread
From: Thomas S. Dye @ 2011-10-18 18:44 UTC (permalink / raw)
To: Eric Schulte; +Cc: nicholas.dokos, Org-mode
Eric Schulte <schulte.eric@gmail.com> writes:
> Nick Dokos <nicholas.dokos@hp.com> writes:
>
>> Thomas S. Dye <tsd@tsdye.com> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-10-18 18:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-18 2:05 Bug passing tables to R code blocks? Thomas S. Dye
2011-10-18 2:45 ` Nick Dokos
2011-10-18 16:09 ` Eric Schulte
2011-10-18 18:44 ` Thomas S. Dye
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).