emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* BUG babel :colnames
@ 2014-02-11 13:23 Andreas Leha
  2014-02-11 20:18 ` Eric Schulte
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Leha @ 2014-02-11 13:23 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

there is a bug when it comes to babel not respecting :colnames when more
variables are passed.

Here is the MWE:

--8<---------------cut here---------------start------------->8---
#+name: testtable2
| a | b |
|---+---|
| 1 | 3 |
| 3 | 3 |
| 4 | 1 |
| 4 | 2 |

#+header: :var testtable=testtable2
#+begin_src R :colnames yes
  testtable[2:3,]
#+end_src

#+results:
| a | b |
|---+---|
| 3 | 3 |
| 4 | 1 |

#+header: :var testtable=testtable2
#+header: :var dummy=20
#+begin_src R :colnames yes
  testtable[2:3,]
#+end_src

#+results:
| X1 | X3 |
|----+----|
|  4 |  1 |
|  4 |  2 |
--8<---------------cut here---------------end--------------->8---


Forgot to say in my last post:
Org-mode version 8.2.5h (release_8.2.5h-581-g7b11ba.dirty @ /home/andreas/local/emacs/org-mode-install/lisp/)
GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2013-12-22 on brahms, modified by Debian


Regards,
Andreas

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: BUG babel :colnames
  2014-02-11 13:23 BUG babel :colnames Andreas Leha
@ 2014-02-11 20:18 ` Eric Schulte
  2014-02-11 23:08   ` Andreas Leha
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Schulte @ 2014-02-11 20:18 UTC (permalink / raw)
  To: Andreas Leha; +Cc: emacs-orgmode

This bug looks to be specific to Babel's R support.  E.g., it is not
present with shell code blocks.

#+name: testtable2
| a | b |
|---+---|
| 1 | 3 |
| 3 | 3 |
| 4 | 1 |
| 4 | 2 |

#+header: :var testtable=testtable2
#+begin_src sh :colnames yes
  echo "$testtable"|tail -2
#+end_src

#+results:
| a | b |
|---+---|
| 4 | 1 |
| 4 | 2 |

#+header: :var testtable=testtable2
#+header: :var dummy=20
#+begin_src sh :colnames yes
  echo "$testtable"|tail -2
#+end_src

#+results:
| a | b |
|---+---|
| 4 | 1 |
| 4 | 2 |

Best,

Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:

> Hi all,
>
> there is a bug when it comes to babel not respecting :colnames when more
> variables are passed.
>
> Here is the MWE:
>
> --8<---------------cut here---------------start------------->8---
> #+name: testtable2
> | a | b |
> |---+---|
> | 1 | 3 |
> | 3 | 3 |
> | 4 | 1 |
> | 4 | 2 |
>
> #+header: :var testtable=testtable2
> #+begin_src R :colnames yes
>   testtable[2:3,]
> #+end_src
>
> #+results:
> | a | b |
> |---+---|
> | 3 | 3 |
> | 4 | 1 |
>
> #+header: :var testtable=testtable2
> #+header: :var dummy=20
> #+begin_src R :colnames yes
>   testtable[2:3,]
> #+end_src
>
> #+results:
> | X1 | X3 |
> |----+----|
> |  4 |  1 |
> |  4 |  2 |
> --8<---------------cut here---------------end--------------->8---
>
>
> Forgot to say in my last post:
> Org-mode version 8.2.5h (release_8.2.5h-581-g7b11ba.dirty @ /home/andreas/local/emacs/org-mode-install/lisp/)
> GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2013-12-22 on brahms, modified by Debian
>
>
> Regards,
> Andreas
>
>

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: BUG babel :colnames
  2014-02-11 20:18 ` Eric Schulte
@ 2014-02-11 23:08   ` Andreas Leha
  0 siblings, 0 replies; 3+ messages in thread
From: Andreas Leha @ 2014-02-11 23:08 UTC (permalink / raw)
  To: emacs-orgmode

Hi Eric,

thanks for looking into this.  And thanks for the confirmation already!

Good to know, that it is specific to R -- I had not checked.  Of course,
I do not want to use R to do mere subsetting, but rather some more
complex processing, which I do not want to do in shell (or elisp,....)

I have some more data on this bug if this is helpful:

(1)
On normal code blocks it depends on the order of the arguments.  It
seems to work for the last argument:

--8<---------------cut here---------------start------------->8---
#+name: testtable2
| a | b |
|---+---|
| 1 | 3 |
| 3 | 3 |
| 4 | 1 |
| 4 | 2 |

#+header: :var testtable=testtable2
#+header: :var dummy=20
#+begin_src R :colnames yes
  testtable[2:3,]
#+end_src

#+results:
| X1 | X3 |
|----+----|
|  4 |  1 |
|  4 |  2 |


#+header: :var dummy=20
#+header: :var testtable=testtable2
#+begin_src R :colnames yes
  testtable[2:3,]
#+end_src

#+results:
| a | b |
|---+---|
| 3 | 3 |
| 4 | 1 |
--8<---------------cut here---------------end--------------->8---

(2)
It is also buggy in call lines:

--8<---------------cut here---------------start------------->8---
#+name: testtable2
| a | b |
|---+---|
| 1 | 3 |
| 3 | 3 |
| 4 | 1 |
| 4 | 2 |


#+name: process_testtable
#+header: :var dummy=20
#+header: :var testtable=testtable2
#+begin_src R :colnames yes
  testtable[2:3,]
#+end_src

#+results: process_testtable
| a | b |
|---+---|
| 3 | 3 |
| 4 | 1 |

#+call: process_testtable() :colnames yes

#+results:
| a | b |
|---+---|
| 3 | 3 |
| 4 | 1 |

#+call: process_testtable(dummy=24) :colnames yes

#+results:
| a | b |
|---+---|
| 4 | 1 |
| 4 | 2 |

#+call: process_testtable(dummy=24, testtable=testtable2) :colnames yes

#+results:
| X1 | X3 |
|----+----|
|  4 |  1 |
|  4 |  2 |

#+call: process_testtable(testtable=testtable2) :colnames yes

#+results:
| X1 | X3 |
|----+----|
|  4 |  1 |
|  4 |  2 |
--8<---------------cut here---------------end--------------->8---


Regards,
Andreas


Eric Schulte <schulte.eric@gmail.com> writes:

> This bug looks to be specific to Babel's R support.  E.g., it is not
> present with shell code blocks.
>
> #+name: testtable2
> | a | b |
> |---+---|
> | 1 | 3 |
> | 3 | 3 |
> | 4 | 1 |
> | 4 | 2 |
>
> #+header: :var testtable=testtable2
> #+begin_src sh :colnames yes
>   echo "$testtable"|tail -2
> #+end_src
>
> #+results:
> | a | b |
> |---+---|
> | 4 | 1 |
> | 4 | 2 |
>
> #+header: :var testtable=testtable2
> #+header: :var dummy=20
> #+begin_src sh :colnames yes
>   echo "$testtable"|tail -2
> #+end_src
>
> #+results:
> | a | b |
> |---+---|
> | 4 | 1 |
> | 4 | 2 |
>
> Best,
>
> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>
>> Hi all,
>>
>> there is a bug when it comes to babel not respecting :colnames when more
>> variables are passed.
>>
>> Here is the MWE:
>>
>> --8<---------------cut here---------------start------------->8---
>> #+name: testtable2
>> | a | b |
>> |---+---|
>> | 1 | 3 |
>> | 3 | 3 |
>> | 4 | 1 |
>> | 4 | 2 |
>>
>> #+header: :var testtable=testtable2
>> #+begin_src R :colnames yes
>>   testtable[2:3,]
>> #+end_src
>>
>> #+results:
>> | a | b |
>> |---+---|
>> | 3 | 3 |
>> | 4 | 1 |
>>
>> #+header: :var testtable=testtable2
>> #+header: :var dummy=20
>> #+begin_src R :colnames yes
>>   testtable[2:3,]
>> #+end_src
>>
>> #+results:
>> | X1 | X3 |
>> |----+----|
>> |  4 |  1 |
>> |  4 |  2 |
>> --8<---------------cut here---------------end--------------->8---
>>
>>
>> Forgot to say in my last post:
>> Org-mode version 8.2.5h (release_8.2.5h-581-g7b11ba.dirty @ /home/andreas/local/emacs/org-mode-install/lisp/)
>> GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2013-12-22 on brahms, modified by Debian
>>
>>
>> Regards,
>> Andreas
>>
>>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-11 23:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-11 13:23 BUG babel :colnames Andreas Leha
2014-02-11 20:18 ` Eric Schulte
2014-02-11 23:08   ` Andreas Leha

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