emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Trouble evaluating R source code blocks with C-c C-c


From: Charles C. Berry
Subject: Re: [O] Trouble evaluating R source code blocks with C-c C-c
Date: Mon, 30 May 2016 09:22:47 -0700
User-agent: Alpine 2.20 (OSX 67 2015-01-07)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]