From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shiyuan Subject: Re: Babel-R TBLFM example Date: Sun, 24 Aug 2014 16:02:33 -0700 Message-ID: References: <8738dl1jm7.fsf@bzg.ath.cx> <8761igfgio.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c28620c8ab5405016810e3 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34132) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLgo0-00080d-Oe for emacs-orgmode@gnu.org; Sun, 24 Aug 2014 19:02:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XLgnz-00033s-Ax for emacs-orgmode@gnu.org; Sun, 24 Aug 2014 19:02:36 -0400 In-Reply-To: <8761igfgio.fsf@bzg.ath.cx> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bastien Cc: "emacs-orgmode@gnu.org" --001a11c28620c8ab5405016810e3 Content-Type: text/plain; charset=UTF-8 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 test-org-babe-meta-programming.org@24170fIx#1) : 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 wrote: > Hi Shiyuan, > > Shiyuan 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 > --001a11c28620c8ab5405016810e3 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I am looking at a simpler example, the pie-chart example a= s in this link:=C2=A0http://orgmode.org/worg/org-contrib/babel/i= ntro.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. = =C2=A0However, when the R code is evaluated, I got an error about the objec= t dirs not found. =C2=A0This is what I got in the buffer running R:=C2=A0
-------------------------------
options(STERM=3D'iE= SS', str.dendrogram.last=3D"'", editor=3D'emacsclient= ', show.error.locations=3DTRUE)
>=C2=A0
Error in= pie(dirs[, 1], labels =3D dirs[, 2]) (from test-org-babe-meta-programming.= org@24170fIx#1) : object 'dirs' not found
-----------------------------------------------

It looks like that the conversion is wrong. =C2=A0When I run `org-bab= el-expand-src-block` on the R source code, I don't see the R object dir= s 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 t= able to R? Thanks.=C2=A0

Shiyuan=C2=A0


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

#+RESULTS: dir= ectories
| =C2=A0 =C2=A0 =C2=A0 8 | #*message*-20140319-231047# |
| 1= 168376 | Documents =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 |
| 9952288 | Downloads =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 |
| =C2=A0 =C2=A0 =C2=A0 8 | xmodmap= 2~ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |

#+name: directory-pie-chart(dirs =3D directories)
#+be= gin_src R :session R-pie-example :file ~/tmp/dirs.png
=C2=A0 pie(= dirs[,1], labels =3D dirs[,2])
#+end_src
<= div class=3D"gmail_extra">

On Tue, Jul 29, 2014 at 6:20 AM, Bastien= <bzg= @gnu.org> wrote:
Hi Shiyuan,

Shiyuan <gshy2014@gmail.com>= ; writes:

> Thanks Bastien. I see ob-R.el from org-mode repo= s has been updated.
> So is the org-R from git-repos ready to use? Could you suggest =C2=A0a=
> 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 her= e
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,

--
=C2=A0Bastien

--001a11c28620c8ab5405016810e3--