From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: Problem whit with code evaluation Date: Wed, 18 Aug 2010 22:37:10 -0400 Message-ID: <874oerxr8p.fsf@stats.ox.ac.uk> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=58623 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Olv0H-0000e3-NN for emacs-orgmode@gnu.org; Wed, 18 Aug 2010 22:37:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Olv0F-0003C6-7m for emacs-orgmode@gnu.org; Wed, 18 Aug 2010 22:37:17 -0400 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:41014) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Olv0F-0003Bl-1I for emacs-orgmode@gnu.org; Wed, 18 Aug 2010 22:37:15 -0400 In-Reply-To: (Marco Blanchette's message of "Wed, 18 Aug 2010 19:12:33 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Blanchette, Marco" Cc: "emacs-orgmode@gnu.org" Hi Marco, "Blanchette, Marco" writes: > Sorry again if this is common knowledge, but the road to orgmode power us= er > is seeded with challenges! > > I am trying to write an R function that would take 3 arguments, hopefully > set up in an org table and have a function run every rows, taking every > column as arguments to produce a set of report files... But I am going a = bit > ahead of myself as I am stuck quite early in the development... > > My problem is quite basic. For some reason, I can=C2=B9t seems to be able= to > execute the following lines in the org buffer using org-babel-execute-buf= fer > or to export an html of the files. The code block just don't execute and > return errors. > > * Examples take from > [[http://orgmode.org/worg/org-contrib/babel/intro.php#sec-7]] > > * The python example > #+source: square(x) > #+begin_src python > x*x > #+end_src This one's our fault. That should be #+begin_src python return x*x #+end_src I've changed it on Worg. > #+call: square(x=3D6) > > * The elisp example of the fibonacci series using a table as argument > > #+tblname: fibonacci-inputs > | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | > | 2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | > > #+srcname: fibonacci-seq(fib-inputs=3Dfibonacci-inputs) > #+begin_src emacs-lisp > (defun fibonacci (n) > (if (or (=3D n 0) (=3D n 1)) > n > (+ (fibonacci (- n 1)) (fibonacci (- n 2))))) >=20=20=20 > (mapcar (lambda (row) > (mapcar #'fibonacci row)) fib-inputs) > #+end_src OK, that works for me. > > * Then my own trial in R > #+srcname: test(x y) ^ missing comma > #+begin_src R > p <- x*y > #+end_src > > #+call test(x=3D4 y=3D9) ^ ^ missing colon, and missing comma > #+function test(x=3D3 y=3D8) That's not correct usage of #+function; you wanted #+lob: / #+call: there. There are two sets of synonymous terms. *Within* each of these sets, the terms are synonymous: {#+function,#+source,#+srcname} {#+lob,#+call} My edited version of your input is below. Hope that helps, do get back to the list if you have further questions. Dan --8<---------------cut here---------------start------------->8--- * Examples take from [[http://orgmode.org/worg/org-contrib/babel/intro.php#sec-7]] * The python example #+source: square(x) #+begin_src python return x*x #+end_src #+call: square(x=3D6) #+results: square(x=3D6) : 36 * The elisp example of the fibonacci series using a table as argument #+tblname: fibonacci-inputs | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | | 2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | #+srcname: fibonacci-seq(fib-inputs=3Dfibonacci-inputs) #+begin_src emacs-lisp (defun fibonacci (n) (if (or (=3D n 0) (=3D n 1)) n (+ (fibonacci (- n 1)) (fibonacci (- n 2))))) =20=20 (mapcar (lambda (row) (mapcar #'fibonacci row)) fib-inputs) #+end_src #+results: fibonacci-seq | 1 | 1 | 2 | 3 | 5 | 8 | 13 | 21 | 34 | 55 | | 1 | 3 | 8 | 21 | 55 | 144 | 377 | 987 | 2584 | 6765 | * Then my own trial in R #+srcname: test(x, y) #+begin_src R p <- x*y #+end_src #+call: test(x=3D4, y=3D9) #+results: test(x=3D4, y=3D9) : 36 #+lob: test(x=3D3, y=3D8) #+results: test(x=3D3, y=3D8) : 24 --8<---------------cut here---------------end--------------->8--- > > Is there something I am missing? > > My current setup is: > GNU Emacs 23.1.50.1 > org-mode (v7.01g) > R v2.11.1 > XServer running Snow Leopard Server 10.6.4 > > Thanks for the help