emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Charles C. Berry" <ccberry@ucsd.edu>
To: Vikas Rawal <vikaslists@agrarianresearch.org>
Cc: William Denton <wtd@pobox.com>,
	org-mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: Trouble evaluating R source code blocks with C-c C-c
Date: Mon, 30 May 2016 09:22:47 -0700	[thread overview]
Message-ID: <alpine.OSX.2.20.1605300829320.532@charles-berrys-macbook.local> (raw)
In-Reply-To: <84824898-5690-4956-A4C6-EC20872896A6@agrarianresearch.org>

On Mon, 30 May 2016, Vikas Rawal wrote:

> Thanks.
>
> The code still seems to freeze.
>
> The backtrace now is.
>

OK, let me abbreviate this by cutting off the ends of long lines:

> Debugger entered--Lisp error: (quit)
>  process-send-string(#<process R> ".ess.eval(\"lm(log_cal~sector+ [...]
>  ess-send-string--fallback(#<process R> ".ess.eval(\"lm(log_cal~  [...]
>  ess-send-string(#<process R> ".ess.eval(\"lm(log_cal~sector+sex+ [...]
>  ess-tracebug-send-region(#<process R> 1 1183 nil "Eval buffer" buffer)
>  ess-send-region(#<process R> 1 1183 nil "Eval buffer" buffer)
>  ess-eval-region(1 1183 nil "Eval buffer" buffer)
>  ess-eval-buffer(nil)
>  org-babel-R-evaluate-session("type2" "lm(log_cal~sector+sex+AgeChild+ [...]
>  org-babel-R-evaluate("type2" "lm(log_cal~sector+sex+AgeChild+AgeAdult+ [...]
>  org-babel-execute:R("lm(log_cal~sector+sex+AgeChild+AgeAdult+foodprice+  [...]
>  org-babel-execute-src-block(nil)
>  org-babel-execute-src-block-maybe()
>  org-babel-execute-maybe()
>  org-babel-execute-safely-maybe()
>  run-hook-with-args-until-success(org-babel-execute-safely-maybe)
>  org-ctrl-c-ctrl-c(nil)
>  call-interactively(org-ctrl-c-ctrl-c nil nil)
>  command-execute(org-ctrl-c-ctrl-c)
>

And what you had previously was [using some abbreviations]:


sit-for(0.25)
org-babel-comint-eval-invisibly-and-wait-for-file("type2" [filename] [R command string] [...]
org-babel-R-evaluate-session("type2" [R command string] ...
org-babel-R-evaluate("type2" [R command string] ...
org-babel-execute:R( [R command string] ...
org-babel-execute-src-block(nil)
org-babel-execute-src-block-maybe()
org-babel-execute-maybe()
org-babel-execute-safely-maybe()
run-hook-with-args-until-success(org-babel-execute-safely-maybe)
org-ctrl-c-ctrl-c(nil)
call-interactively(org-ctrl-c-ctrl-c nil nil)
command-execute(org-ctrl-c-ctrl-c)

What you can see is that everything is the same right up to this line

      `org-babel-R-evaluate-session(...'

but in the top (most recent) version ess-* functions are shown right
up to process-send-string, which means that ess is still trying to
complete its work. In the older (bottom) version ess is done and babel
is waiting for the resulting file.

This makes me wonder what R is doing.

Can you check the activity monitor (you are on OS X, right?) and see
what is happening? If the R code takes a long time to run and the R
process is chewing up CPU or reading from/writing to disk this would
explain it.

If that isn't it, you might try to put in some checkpoints to see how
far the R code got. I'd put something like

     cat("Starting",file="progress.txt")

at the top of your src code and

    cat(".",file="progress.txt",append=TRUE)

after every line and

    cat("Done\n",file="progress.txt",append=TRUE)

after the last command at the very bottom.

Then if the R code hangs somewhere you can open `progress.txt', count
up the dots, and see where it got to.

If that does not appeal to you, then profiling the R code might
do. see ?Rprof.

Finally, you aren't doing something exotic - like trying to run src
blocks from a local buffer in a remote session - are you? If so, that
adds a layer of complexity that needs discussion.

HTH,

Chuck

  reply	other threads:[~2016-05-30 16:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-26 14:33 Trouble evaluating R source code blocks with C-c C-c Vikas Rawal
2016-05-26 18:52 ` John Hendy
2016-05-28  7:58   ` Vikas Rawal
2016-05-28 14:27     ` William Denton
2016-05-28 16:57       ` Charles C. Berry
2016-05-28 17:01         ` Charles C. Berry
2016-05-29 12:31           ` Vikas Rawal
2016-05-29 13:13           ` Vikas Rawal
2016-05-29 17:58             ` Charles C. Berry
2016-05-30  0:37               ` Vikas Rawal
2016-05-30  1:18                 ` Charles C. Berry
2016-05-30 10:24                   ` Vikas Rawal
2016-05-30 16:22                     ` Charles C. Berry [this message]
2016-05-29  2:02       ` Vikas Rawal

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=alpine.OSX.2.20.1605300829320.532@charles-berrys-macbook.local \
    --to=ccberry@ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=vikaslists@agrarianresearch.org \
    --cc=wtd@pobox.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).