[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] Re: Problem whit with code evaluation
From: |
Dan Davison |
Subject: |
[Orgmode] Re: Problem whit with code evaluation |
Date: |
Thu, 19 Aug 2010 00:23:30 -0400 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (gnu/linux) |
"Blanchette, Marco" <address@hidden> writes:
> Hmm... Thanks Dan.
>
> Do we have a different version of org-mode? I just pasted your code in emacs
> and try to execute it with M-x org-babel-execute-buffer RET without success.
Hi Marco,
Sorry, I was rushing and missed that you were using
org-babel-execute-buffer. I'll look into it.
Dan
>
> The emacs-lisp code works but the python and the R crashes with the
> following errors taken from the *Org-Babel Error* Output buffer
>
> Traceback (most recent call last):
> File "<stdin>", line 5, in <module>
> File "<stdin>", line 3, in main
> NameError: global name 'x' is not defined
> Error in main() : object 'x' not found
> Calls: write.table -> is.data.frame -> inherits -> main
> Execution halted
>
> The first 4 lines comes from the python script while the last 3 come from
> the R script
>
> Here is my .emacs org-mode configs in case you are wondering...
>
> ;;Load org-mode and set global keys
> (require 'org-install)
> (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
> (add-hook 'org-mode-hook 'turn-on-font-lock) ; not needed when
> global-font-lock-mode is on
> (define-key global-map "\C-cl" 'org-store-link)
> (define-key global-map "\C-ca" 'org-agenda)
> (setq org-log-done t)
> (setq org-startup-indented t)
>
>
> ;; active Babel languages
> (org-babel-do-load-languages
> 'org-babel-load-languages
> '(
> (R . t)
> (sh .t)
> (python . t)
> (emacs-lisp . t)
> )
> )
>
> Thanks again
>
>
> On 8/18/10 9:37 PM, "Dan Davison" <address@hidden> wrote:
>
>> * The python example
>> #+source: square(x)
>> #+begin_src python
>> return x*x
>> #+end_src
>>
>> #+call: square(x=6)
>>
>> #+results: square(x=6)
>> : 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=fibonacci-inputs)
>> #+begin_src emacs-lisp
>> (defun fibonacci (n)
>> (if (or (= n 0) (= n 1))
>> n
>> (+ (fibonacci (- n 1)) (fibonacci (- n 2)))))
>>
>> (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=4, y=9)
>>
>> #+results: test(x=4, y=9)
>> : 36
>>
>> #+lob: test(x=3, y=8)
>>
>> #+results: test(x=3, y=8)
>> : 24
>
> --
> Marco Blanchette, Ph.D.
> Assistant Investigator
> Stowers Institute for Medical Research
> 1000 East 50th St.
>
> Kansas City, MO 64110
>
> Tel: 816-926-4071
> Cell: 816-726-8419
> Fax: 816-926-2018
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode