emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tsd@tsdye.com (Thomas S. Dye)
To: Eric Schulte <schulte.eric@gmail.com>
Cc: nicholas.dokos@hp.com, Org-mode <emacs-orgmode@gnu.org>
Subject: Re: Bug passing tables to R code blocks?
Date: Tue, 18 Oct 2011 08:44:31 -1000	[thread overview]
Message-ID: <m1k482dtrk.fsf@tsdye.com> (raw)
In-Reply-To: <87r52a2se1.fsf@gmail.com> (Eric Schulte's message of "Tue, 18 Oct 2011 10:09:42 -0600")

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

      reply	other threads:[~2011-10-18 18:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1k482dtrk.fsf@tsdye.com \
    --to=tsd@tsdye.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=nicholas.dokos@hp.com \
    --cc=schulte.eric@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).