Hi Chris; this digressed enough into a babel problem that I started a new subject for the list. On Thu, Feb 2, 2012 at 11:19 AM, Christopher W. Ryan <cryan@binghamton.edu> wrote: > Just tried a similar thing on my computer at work: WinXP, emacs-22.3.1, > org-mode 7.7. I tried both R and python. With this in my .emacs file: > > ;; active Babel languages > (org-babel-do-load-languages > 'org-babel-load-languages > '((R . t) > (python . t) > )) > > Here are the contents of the org file I am playing with: > > #+begin_src R > rnorm(10) > #+end_src > > #+begin_src python > print "Hello, World!" > #+end_src > > > C-c C-c the first block results in a message like this: > > Evaluate this R code block on your system? (yes or no) > > Answering yes yields: > > No org-babel-execute function for R! > > Trying the same in the python block yields the same results, except with > "python" substituted for "R" in all the messages. > > Any suggestions where I am going wrong? Silly question... do you have both R and python installed on your computer? Perhaps provide the paths of your R and python executable files. Win settings can be tricky sometimes. Another question would be, how do you typically use R and python directly? John > > Thanks. > > --Chris Ryan >
John and Nick--
The question about whether I have python on my machine is not silly--I
am. Got so carried away I forgot I was on my work computer, which indeed
does not have python. But I do have R and perl, and similar code blocks
in either language yield the same problem, so I'll just focus on them as
examples (he said, sheepishly.)
I usually interface with R via emacs ESS. Currently ESS is using R
version 2.11.1.
R executable is in C:\Program Files\R\R-2.11.1\bin
I usually interface with perl via another text editor, Programmer's
Notepad, set up with drop-down menu item to execute the file in perl.
Perl executable is in C:\strawberry\perl\bin
C:\Org\org-7.7\lisp contains, among others, files called ob-R.el and
ob-perl.el
Currently my path variable looks like this:
Files\QuickTime\QTSystem\;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Xpdf;C:\strawberry\perl\bin;C:\strawberry\c\bin;C:\strawberry\perl\site\bin
My .emacs now contains:
;; active Babel languages
(org-babel-do-load-languages
'org-babel-load-languages
'((R . t)
(python . t)
(perl . t)
))
As to Nick's questions,
M-x locate-library RET ob-R RET
tells me ob-R is located in C:\Org\org-7.7\lisp\ob-R.el
M-: to evaluate (require 'ob-R.el)
yields ob-R in the minibuffer
Then C-c C-c in the R code block yields
Code block produced not output.
in the minibuffer,
and a new buffer that says,
'R' is not recognized as an internal or external command,
operable program or batch file.
I tried evaluating (require 'ob-perl) and this yielded
ob-perl
in the minibuffer, and thereafter the perl code block executed properly.
I wonder if I need to put the path to R in my PATH variable? (come to
think of it, don't know why it's not already there); its absence has so
far not prevented me from using R via ESS.
Thanks.
--Chris
Christopher W. Ryan, MD
SUNY Upstate Medical University Clinical Campus at Binghamton
425 Robinson Street, Binghamton, NY 13904
cryanatbinghamtondotedu
John Hendy wrote:
> Hi Chris; this digressed enough into a babel problem that I started a
> new subject for the list.
>
> On Thu, Feb 2, 2012 at 11:19 AM, Christopher W. Ryan
> <cryan@binghamton.edu> wrote:
>> Just tried a similar thing on my computer at work: WinXP, emacs-22.3.1,
>> org-mode 7.7. I tried both R and python. With this in my .emacs file:
>>
>> ;; active Babel languages
>> (org-babel-do-load-languages
>> 'org-babel-load-languages
>> '((R . t)
>> (python . t)
>> ))
>>
>> Here are the contents of the org file I am playing with:
>>
>> #+begin_src R
>> rnorm(10)
>> #+end_src
>>
>> #+begin_src python
>> print "Hello, World!"
>> #+end_src
>>
>>
>> C-c C-c the first block results in a message like this:
>>
>> Evaluate this R code block on your system? (yes or no)
>>
>> Answering yes yields:
>>
>> No org-babel-execute function for R!
>>
>> Trying the same in the python block yields the same results, except with
>> "python" substituted for "R" in all the messages.
>>
>> Any suggestions where I am going wrong?
>
> Silly question... do you have both R and python installed on your
> computer? Perhaps provide the paths of your R and python executable
> files. Win settings can be tricky sometimes. Another question would
> be, how do you typically use R and python directly?
>
> John
>
>>
>> Thanks.
>>
>> --Chris Ryan
>>
Christopher W. Ryan <cryan@binghamton.edu> wrote: > John and Nick-- > > The question about whether I have python on my machine is not silly--I > am. Got so carried away I forgot I was on my work computer, which indeed > does not have python. But I do have R and perl, and similar code blocks > in either language yield the same problem, so I'll just focus on them as > examples (he said, sheepishly.) > > I usually interface with R via emacs ESS. Currently ESS is using R > version 2.11.1. > > R executable is in C:\Program Files\R\R-2.11.1\bin > > I usually interface with perl via another text editor, Programmer's > Notepad, set up with drop-down menu item to execute the file in perl. > > Perl executable is in C:\strawberry\perl\bin > > C:\Org\org-7.7\lisp contains, among others, files called ob-R.el and > ob-perl.el > > Currently my path variable looks like this: > > Files\QuickTime\QTSystem\;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Xpdf;C:\strawberry\perl\bin;C:\strawberry\c\bin;C:\strawberry\perl\site\bin > > > My .emacs now contains: > > ;; active Babel languages > (org-babel-do-load-languages > 'org-babel-load-languages > '((R . t) > (python . t) > (perl . t) > )) > > > As to Nick's questions, > > M-x locate-library RET ob-R RET > > tells me ob-R is located in C:\Org\org-7.7\lisp\ob-R.el > > M-: to evaluate (require 'ob-R.el) > > yields ob-R in the minibuffer > > Then C-c C-c in the R code block yields > > Code block produced not output. > > in the minibuffer, > > and a new buffer that says, > > 'R' is not recognized as an internal or external command, > operable program or batch file. > It's probably a path issue as you surmise below. ob-R.el includes the following: (defvar org-babel-R-command "R --slave --no-save" "Name of command to use for executing R code.") Try setting something like (setq org-bable-R-command "/full/path/to/R --slave --no-save") in your .emacs, although the exact format for Windows is going to be different. This is meant as a test, not as a fix: if that works, then you can figure out how to change your path and get rid of the hack. > > I tried evaluating (require 'ob-perl) and this yielded > > ob-perl > > in the minibuffer, and thereafter the perl code block executed properly. > Ok, that's promising. > I wonder if I need to put the path to R in my PATH variable? (come to > think of it, don't know why it's not already there); its absence has so > far not prevented me from using R via ESS. > Probably. Nick