From: Nick Dokos <nicholas.dokos@hp.com>
To: John Hendy <jw.hendy@gmail.com>
Cc: Achim Gratz <Stromeko@nexgo.de>, emacs-orgmode@gnu.org
Subject: Re: R and babel on Windows problem
Date: Fri, 06 Jul 2012 14:45:34 -0400 [thread overview]
Message-ID: <23203.1341600334@alphaville> (raw)
In-Reply-To: Message from John Hendy <jw.hendy@gmail.com> of "Fri, 06 Jul 2012 12:46:44 CDT." <CA+M2ft-HbzS8Ti-_iAL0QN+htwDZtNHAfxnj0y5_=n75QvZf1w@mail.gmail.com>
John Hendy <jw.hendy@gmail.com> wrote:
> On Fri, Jul 6, 2012 at 12:12 PM, Nick Dokos <nicholas.dokos@hp.com> wrote:
> > John Hendy <jw.hendy@gmail.com> wrote:
> >
> >> Any updates on this? Could someone provide a minimal example I could
> >> try? Or verify that my steps above are correct. I'm not sure why it's
> >> not triggering the step by step function execution described.
> >>
> >
> > I had sent out a note about C-u C-M-x and what you should see in the
> > echo area after that, but I don't think I've seen a reply: did you try
> > that and did it work as expected?
> >
> > Either gmane is or I am being stupid right now and cannot find the message
> > (maybe it never made it, but gmane cannot seem to find the thread at all
> > right now), so I append a copy of that message.
>
> Yes. I guess I didn't explicitly say, but I mentioned that I had
> triggered something goofy by accident in my earlier hunt for edebug.
> I'll walkthrough right now:
> - Got to ob-R.el in emacs
> - C-s to find org-babel-R-evaluate-external-process
> - C-u C-M-x
> - Minibuffer: "Edebug: org-babel-R-evaluate-external-process"
> - Visit file test.org
> - C-c C-c on the src block
> - Well... of course it works now. Not sure what I was doing wrong before.
>
The reason that I sent out that note was that you mentioned pressing M-x
C-M-x (rather than C-u C-M-x) and getting the name of the function
echoed (without the "Edebug: " part), so I wanted to make sure that you
were DTRT here. Could that be what you were doing wrong? or was that a
typo on your part?
> I pressed space continually until failure, then again to verify the
> failing line. It's this one (line 313):
>
> ,---
> | (output (org-babel-eval org-babel-R-command body))))
> `---
>
Just fyi and to clarify some basic lisp: the form
(org-babel-eval org-babel-R-command body)
says: evaluate the org-babel-eval function with arguments
org-babel-R-command and body (actually, those variables are evaluated
first and then the *values* are passed to the function). The evaluation
returns a result (a string in this case) which is assigned to the local
variable output for further processing (local, because this whole thing
is part of a let-form which is not shown in your snippet).
I.e. a function call in lisp always looks like this:
(<func> <arg1> <arg2> ....)
> When I run this line:
>
> ,---
> | (org-babel-eval org-babel-R-command
> `---
>
> I get this in the minibuffer:
>
> ,---
> | Result: "C:/Progra~1/R/R-2.15.0/bin/R"
> `---
>
I presume you just typed "e" when the cursor was after the variable:
that just evaluates the variable. If you press SPACE then the cursor
would advance to after the ``body'' variable (on the closing paren) and
an "e" would evaluate *that* variable. After another SPACE, the cursor
would be *after* the closing paren and an "e" would evaluate the function
call and you would see the result, i.e. what would be assigned to
``output''.
> Should I be able to run this from the Windows cmd prompt successfully?
> I think this is my problem. Even using tab completion to ensure the
> path is correct, I get the same error message "The system cannot find
> the path specified" when I run this from cmd!
>
> I guess I honed in on my problem. I can run R from my Start Menu shortcut fine.
>
> Update: I'm on 64bit and just now realized there's another set of R
> cmds in ../R-2.15.0/bin/x64/. This is what I needed.
>
> Now my problem is that using R along doesn't produce any output. With
> the above modification, I get:
>
> ,---
> | Fatal error: you must specify '--save', '--no-save' or '--vanilla'
> `---
>
> I'm quite close! If I add --no-save, I get exported results but they
> include all of the R preamble text from when it starts. Here's my
> block for reference:
>
> #+begin_src R :results output org :exports results
>
> x <- c(1:10)
> summary(x)
>
> #+end_src
>
OK, at this point I will "exit, stage left, chased by a bear", since
both Windoze and R are within my areas of almost complete ignorance :-)
Nick
>
>
> Thanks,
> John
>
>
> >
> > Nick
> >
> >
> > John Hendy <jw.hendy@gmail.com> wrote:
> > ...
> >> >
> >> > Oh, sorry: edebug is described in
> >> >
> >> > (info "(elisp) Edebug")
> >> >
> >> > The basics: visit ob-R.el, go to the org-babel-R-evaluate-external-process
> >> > definition and press C-u C-M-x. Then do whatever you were doing to get the
> >> > problem. It should stop at the function and you can single-step by pressing
> >> > SPACE. At strategic points, you can evaluate things with "e".
> >>
> >> Eeks. Is the fact that I learned emacs only for org-mode showing. I
> >> don't even know how to =(info "(elisp) Edebug")= -- do I put an =M-x=
> >> in front of that? =M-x info= seems to bring me to a help page for
> >> info!
> >>
> >
> > You have to evaluate it somehow. If you are reading your mail in emacs,
> > just place the cursor after the closing paren and press C-x C-e. If not,
> > just go to emacs and "C-h i elisp RET i edebug RET" or equivalently,
> > type ESC ESC : (info "(elisp) Edebug") RET. Underlying assumption: you
> > have the Emacs Lisp info files installed.
> >
> >> Anyway... I just googled edebug and it says about the same as you did
> >> (except for appending "eval-defun with a prefix argument" onto =C-u
> >> C-M-x=.
> >> - http://www.gnu.org/software/emacs/manual/html_node/elisp/Using-Edebug.html
> >>
> >> Anyway:
> >> - Visited ob-R.el in emacs
> >> - Found org-babel-R-evaluate-external-process
> >> - Put the cursor on the line =(defun org-babel-R-evaluate-external-process=
> >> - Did =M-x C-M-x= and the minibuffer echoed the name of the function
> >
> > C-u C-M-x please: and the echo area should say "Edebug:
> > org-babel-R-evaluate-external-process" afterwards.
> >
> > Nick
> >
> >> - Visited my file, test.org and did =C-c C-c= on the R babel block
> >> - Nothing different occurred; I just got "The system cannot find the
> >> path specified"
> >>
> >> I tried the above again with regular 'ol org-babel-R-evaluate just in
> >> case and had the same results.
> >>
> >> I'm clearly goofing something but have no idea what it is.
> >>
> >>
> >> John
> >>
> >>
> >> >
> >> > If you mess it up (and you probably will a few times), no problem: just try
> >> > again. And be patient!
> >> >
> >> > Good luck,
> >> > Nick
> >> >
> >> >
> >> >
> >> >>
> >> >> John
> >> >>
> >> >>
> >> >> >
> >> >> > Nick
> >> >> >
> >> >> >> Using =M-x R= works find. ESS is finding R. I successfully loaded a
> >> >> >> .csv, ggplot2 and plotted.
> >> >> >>
> >> >> >>
> >> >> >> John
> >> >> >>
> >> >> >> John
> >> >> >>
> >> >> >> >
> >> >> >> > Nick
> >> >> >> >
> >> >> >>
> >> >>
> >>
> >
> >
>
next prev parent reply other threads:[~2012-07-06 18:46 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-28 17:46 R and babel on Windows problem John Hendy
2012-06-29 14:59 ` Alexander Vorobiev
2012-06-29 15:24 ` John Hendy
2012-06-29 17:12 ` Alexander Vorobiev
2012-06-29 18:26 ` Achim Gratz
2012-06-29 19:31 ` John Hendy
2012-06-29 19:37 ` Nick Dokos
2012-06-29 20:00 ` John Hendy
2012-06-29 20:16 ` Nick Dokos
2012-07-02 20:15 ` John Hendy
2012-07-02 21:26 ` Nick Dokos
2012-07-02 21:47 ` John Hendy
2012-07-02 22:15 ` Nick Dokos
2012-07-02 22:16 ` John Hendy
2012-07-06 16:58 ` John Hendy
2012-07-06 17:12 ` Nick Dokos
2012-07-06 17:46 ` John Hendy
2012-07-06 18:41 ` Eric Schulte
2012-07-06 22:05 ` John Hendy
2012-07-06 18:45 ` Nick Dokos [this message]
2012-07-06 22:08 ` John Hendy
2012-07-06 22:14 ` John Hendy
2012-07-07 1:02 ` Eric Schulte
2012-07-07 1:48 ` Nick Dokos
2012-07-16 0:42 ` John Hendy
2012-06-30 5:13 ` Achim Gratz
2012-06-30 13:15 ` Eric Schulte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=23203.1341600334@alphaville \
--to=nicholas.dokos@hp.com \
--cc=Stromeko@nexgo.de \
--cc=emacs-orgmode@gnu.org \
--cc=jw.hendy@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).