emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Bug: Babel+R handles spaces wrongly in tables [9.3.6 (release_9.3.6


From: Berry, Charles
Subject: Re: Bug: Babel+R handles spaces wrongly in tables [9.3.6 (release_9.3.6 @ /home/cassou/.emacs.d/lib/org/lisp/)]
Date: Sun, 6 Sep 2020 18:23:19 +0000


> On Sep 6, 2020, at 4:32 AM, Damien Cassou <damien@cassou.me> wrote:
> 
> 
> Hi,
> 
> it seems that, if a cell within a table contains a space, the
> corresponding value passed as parameter to a R script will be
> wrong.


Not exactly. Your ECM has one column, and using both columns removes the issue.

Here is another ECM that illustrates the bug:

#+begin_src R :results output :var accounts=(identity '("A B" "C")) 
print(accounts)
#+end_src


The bug is in `org-babel-R-assign-elisp' which attempts to get the number of 
elements in each line of a table, but when the table has just one row or column 
it gets this wrong.


> Please find a very simple org file attached to this email. I
> expect the length of the variable to be 2 (which is the length of '("A
> B" "C") and not 3. Apparently, R receives this array instead: '("A B"
> "C" nil).
> 

Actually the length should be 1, i.e. a data.frame with a single column of two 
elements.

BTW, C-c C-v C-v with point in the src block will show you what R `receives'.

Unfortunately, there are other cases where the variable assignment does not 
work seamlessly for R src blocks.  There are workarounds, but they are ungainly 
- like using a src block for another language to render the table and then 
using a noweb reference to it to import the data. 

HTH,
Chuck



reply via email to

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