emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] babel R: should/does order of parameters matter?


From: Myles English
Subject: Re: [O] babel R: should/does order of parameters matter?
Date: Tue, 29 Mar 2011 16:57:37 +0100

Eric,

On 23 March 2011 03:03, Eric Schulte <address@hidden> wrote:
> I believe the problem here is that your :var header argument syntax is
> wrong.  A :var header argument must have a name, and equals sign, and an
> assignment for the variable, e.g.
>
> #+begin_src sh :var name="eric"
>  echo $name
> #+end_src
>
> #+results:
> : eric

Thanks for your reply, I think I deviated from the correct syntax
while experimenting.  After some more research I think I may have
found either a bug or an omission from the manual.

In order for R to assign column names to the resulting dataframe,
an argument that is a table name must be the first argument at
the point where a function is called from, whether it is executed
directly (from within a source block) or by a #+call.

The full org file that I believe verifies the above statement is
http://pastebin.com/iixQdS0G , but to illustrate the issue:

#+TBLNAME: data
| x | parameter | value |
|---+-----------+-------|
| 0 | heat      |    30 |
| 1 | heat      |    30 |

#+source: func5
#+begin_src R :var name=data :var a="one" :colnames yes
names(name)
#+end_src

executing directly works as expected:

#+results: func5
| x         |
|-----------|
| x         |
| parameter |
| value     |

try a basic call (ignores :colnames):

#+call: func5(name=data, a="two")

#+results: func5(name=data, a="two")
| x         |
| parameter |
| value     |

however, with the table argument last:

#+call: func5(a="two",name=data)

#+results: func5(a="two",name=data)
| X0   |
| heat |
| X30  |

of course I have also tried swapping the order of the arguments
in the source block (and the #+calls) and the statement still stands.

Is this confirmable as a bug or have I gone wrong again somewhere?

Thanks,

Myles



reply via email to

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