emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Babel-R TBLFM example


From: Shiyuan
Subject: Re: [O] Babel-R TBLFM example
Date: Sun, 24 Aug 2014 16:02:33 -0700

I am looking at a simpler example, the pie-chart example as in this link: http://orgmode.org/worg/org-contrib/babel/intro.html#literate-programming

This example(src code attached in the end) first generates a table by a shell command and then run a R one-liner which uses the table.  However, when the R code is evaluated, I got an error about the object dirs not found.  This is what I got in the buffer running R: 
-------------------------------
options(STERM='iESS', str.dendrogram.last="'", editor='emacsclient', show.error.locations=TRUE)
Error in pie(dirs[, 1], labels = dirs[, 2]) (from address@hidden) : object 'dirs' not found
-----------------------------------------------

It looks like that the conversion is wrong.  When I run `org-babel-expand-src-block` on the R source code, I don't see the R object dirs is expanded to anything. I don't understand how the conversion works, and how Babel passes the table to R. Any explanation is appreciated. Which function/file should I look at? Are there working examples for passing a table to R? Thanks. 

Shiyuan 


------------------------------
#+name: directories
#+begin_src shell :results replace
  cd ~ && du -sc * |grep -v total
#+end_src

#+RESULTS: directories
|       8 | #*message*-20140319-231047# |
| 1168376 | Documents                   |
| 9952288 | Downloads                   |
|       8 | xmodmap2~                   |

#+name: directory-pie-chart(dirs = directories)
#+begin_src R :session R-pie-example :file ~/tmp/dirs.png
  pie(dirs[,1], labels = dirs[,2])
#+end_src


On Tue, Jul 29, 2014 at 6:20 AM, Bastien <address@hidden> wrote:
Hi Shiyuan,

Shiyuan <address@hidden> writes:

> Thanks Bastien. I see ob-R.el from org-mode repos has been updated.
> So is the org-R from git-repos ready to use? Could you suggest  a
> good place to start learning the new org-R? The source file ob-R.el?

The recent committers to ob-R.el we be more in a position to help here
but yes, reading the source is certainly a good start.

I hope we will have a clear picture of what changed in ob-R.el in 8.3,
together with updated tutorials.

Best,

--
 Bastien


reply via email to

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