From: Vikas Rawal <vikaslists@agrarianresearch.org>
To: "Charles C. Berry" <ccberry@ucsd.edu>
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 15:54:53 +0530 [thread overview]
Message-ID: <84824898-5690-4956-A4C6-EC20872896A6@agrarianresearch.org> (raw)
In-Reply-To: <alpine.OSX.2.20.1605291758200.1797@charles-berrys-macbook.local>
Thanks.
The code still seems to freeze.
The backtrace now is.
Debugger entered--Lisp error: (quit)
process-send-string(#<process R> ".ess.eval(\"lm(log_cal~sector+sex+AgeChild+AgeAdult+foodprice+log(MPCE)+state_region,data=regdata,weights=weight)->reg\nlm(adj_cal~sector+sex+AgeChild+AgeAdult+foodprice+log(MPCE)+state_region,data=regdata,weights=weight)->reg.1\nlibrary(car)\nlibrary(lmtest)\nlibrary(sandwich)\ncov1 <- vcovHC(reg, type = \\\"HC1\\\")\nrobust_se <- sqrt(diag(cov1))\n\ncov2 <- vcovHC(reg.1, type = \\\"HC1\\\")\nrobust_se2 <- sqrt(diag(cov2))\n # Adjust F statistic\nwald_results <- waldtest(reg, vcov = cov1)\nwald_results2 <- waldtest(reg.1, vcov = cov2)\n\n #coeftest(reg, vcov = hccm)->reg2\noptions(scipen = 999)\nlibrary(stargazer)\nstargazer(reg.1,reg,\n align=TRUE,\n title=\\\"Regression of per capita calorie intake with monthly per capita consumer expenditure, and demographic and other socio-economic variables\\\",\n dep.var.labels = c(\\\"Per capita calorie intake\\\",\\\"Log of per capita calorie intake\\\"),\n se=list(NULL,robust_se,robust_se2),\n omit=\\\"state\\\",\n model.numbers=FALSE,\n report = \\\"vct*\\\",\n single.row=TRUE,\n omit.labels = \\\"State and region dummies\\\")\", visibly = FALSE, output = TRUE, file = '/var/folders/hj/hqfjch716qg5php160jbtfgh0000gn/T/unknown!53134yFm')\n")
ess-send-string--fallback(#<process R> ".ess.eval(\"lm(log_cal~sector+sex+AgeChild+AgeAdult+foodprice+log(MPCE)+state_region,data=regdata,weights=weight)->reg\nlm(adj_cal~sector+sex+AgeChild+AgeAdult+foodprice+log(MPCE)+state_region,data=regdata,weights=weight)->reg.1\nlibrary(car)\nlibrary(lmtest)\nlibrary(sandwich)\ncov1 <- vcovHC(reg, type = \\\"HC1\\\")\nrobust_se <- sqrt(diag(cov1))\n\ncov2 <- vcovHC(reg.1, type = \\\"HC1\\\")\nrobust_se2 <- sqrt(diag(cov2))\n # Adjust F statistic\nwald_results <- waldtest(reg, vcov = cov1)\nwald_results2 <- waldtest(reg.1, vcov = cov2)\n\n #coeftest(reg, vcov = hccm)->reg2\noptions(scipen = 999)\nlibrary(stargazer)\nstargazer(reg.1,reg,\n align=TRUE,\n title=\\\"Regression of per capita calorie intake with monthly per capita consumer expenditure, and demographic and other socio-economic variables\\\",\n dep.var.labels = c(\\\"Per capita calorie intake\\\",\\\"Log of per capita calorie intake\\\"),\n se=list(NULL,robust_se,robust_se2),\n omit=\\\"state\\\",\n model.numbers=FALSE,\n report = \\\"vct*\\\",\n single.row=TRUE,\n omit.labels = \\\"State and region dummies\\\")\", visibly = FALSE, output = TRUE, file = '/var/folders/hj/hqfjch716qg5php160jbtfgh0000gn/T/unknown!53134yFm')\n" nil "Eval buffer")
ess-send-string(#<process R> ".ess.eval(\"lm(log_cal~sector+sex+AgeChild+AgeAdult+foodprice+log(MPCE)+state_region,data=regdata,weights=weight)->reg\nlm(adj_cal~sector+sex+AgeChild+AgeAdult+foodprice+log(MPCE)+state_region,data=regdata,weights=weight)->reg.1\nlibrary(car)\nlibrary(lmtest)\nlibrary(sandwich)\ncov1 <- vcovHC(reg, type = \\\"HC1\\\")\nrobust_se <- sqrt(diag(cov1))\n\ncov2 <- vcovHC(reg.1, type = \\\"HC1\\\")\nrobust_se2 <- sqrt(diag(cov2))\n # Adjust F statistic\nwald_results <- waldtest(reg, vcov = cov1)\nwald_results2 <- waldtest(reg.1, vcov = cov2)\n\n #coeftest(reg, vcov = hccm)->reg2\noptions(scipen = 999)\nlibrary(stargazer)\nstargazer(reg.1,reg,\n align=TRUE,\n title=\\\"Regression of per capita calorie intake with monthly per capita consumer expenditure, and demographic and other socio-economic variables\\\",\n dep.var.labels = c(\\\"Per capita calorie intake\\\",\\\"Log of per capita calorie intake\\\"),\n se=list(NULL,robust_se,robust_se2),\n omit=\\\"state\\\",\n model.numbers=FALSE,\n report = \\\"vct*\\\",\n single.row=TRUE,\n omit.labels = \\\"State and region dummies\\\")\", visibly = FALSE, output = TRUE, file = '/var/folders/hj/hqfjch716qg5php160jbtfgh0000gn/T/unknown!53134yFm')\n" nil "Eval buffer")
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+AgeAdult+foodprice+log(MPCE)+state_region,data=regdata,weights=weight)->reg\nlm(adj_cal~sector+sex+AgeChild+AgeAdult+foodprice+log(MPCE)+state_region,data=regdata,weights=weight)->reg.1\nlibrary(car)\nlibrary(lmtest)\nlibrary(sandwich)\ncov1 <- vcovHC(reg, type = \"HC1\")\nrobust_se <- sqrt(diag(cov1))\n\ncov2 <- vcovHC(reg.1, type = \"HC1\")\nrobust_se2 <- sqrt(diag(cov2))\n # Adjust F statistic\nwald_results <- waldtest(reg, vcov = cov1)\nwald_results2 <- waldtest(reg.1, vcov = cov2)\n\n #coeftest(reg, vcov = hccm)->reg2\noptions(scipen = 999)\nlibrary(stargazer)\nstargazer(reg.1,reg,\n align=TRUE,\n title=\"Regression of per capita calorie intake with monthly per capita consumer expenditure, and demographic and other socio-economic variables\",\n dep.var.labels = c(\"Per capita calorie intake\",\"Log of per capita calorie intake\"),\n se=list(NULL,robust_se,robust_se2),\n omit=\"state\",\n model.numbers=FALSE,\n report = \"vct*\",\n single.row=TRUE,\n omit.labels = \"State and region dummies\")" value ("replace" "scalar" "latex") nil nil)
org-babel-R-evaluate("type2" "lm(log_cal~sector+sex+AgeChild+AgeAdult+foodprice+log(MPCE)+state_region,data=regdata,weights=weight)->reg\nlm(adj_cal~sector+sex+AgeChild+AgeAdult+foodprice+log(MPCE)+state_region,data=regdata,weights=weight)->reg.1\nlibrary(car)\nlibrary(lmtest)\nlibrary(sandwich)\ncov1 <- vcovHC(reg, type = \"HC1\")\nrobust_se <- sqrt(diag(cov1))\n\ncov2 <- vcovHC(reg.1, type = \"HC1\")\nrobust_se2 <- sqrt(diag(cov2))\n # Adjust F statistic\nwald_results <- waldtest(reg, vcov = cov1)\nwald_results2 <- waldtest(reg.1, vcov = cov2)\n\n #coeftest(reg, vcov = hccm)->reg2\noptions(scipen = 999)\nlibrary(stargazer)\nstargazer(reg.1,reg,\n align=TRUE,\n title=\"Regression of per capita calorie intake with monthly per capita consumer expenditure, and demographic and other socio-economic variables\",\n dep.var.labels = c(\"Per capita calorie intake\",\"Log of per capita calorie intake\"),\n se=list(NULL,robust_se,robust_se2),\n omit=\"state\",\n model.numbers=FALSE,\n report = \"vct*\",\n single.row=TRUE,\n omit.labels = \"State and region dummies\")" value ("replace" "scalar" "latex") nil nil)
org-babel-execute:R("lm(log_cal~sector+sex+AgeChild+AgeAdult+foodprice+log(MPCE)+state_region,data=regdata,weights=weight)->reg\nlm(adj_cal~sector+sex+AgeChild+AgeAdult+foodprice+log(MPCE)+state_region,data=regdata,weights=weight)->reg.1\nlibrary(car)\nlibrary(lmtest)\nlibrary(sandwich)\ncov1 <- vcovHC(reg, type = \"HC1\")\nrobust_se <- sqrt(diag(cov1))\n\ncov2 <- vcovHC(reg.1, type = \"HC1\")\nrobust_se2 <- sqrt(diag(cov2))\n # Adjust F statistic\nwald_results <- waldtest(reg, vcov = cov1)\nwald_results2 <- waldtest(reg.1, vcov = cov2)\n\n #coeftest(reg, vcov = hccm)->reg2\noptions(scipen = 999)\nlibrary(stargazer)\nstargazer(reg.1,reg,\n align=TRUE,\n title=\"Regression of per capita calorie intake with monthly per capita consumer expenditure, and demographic and other socio-economic variables\",\n dep.var.labels = c(\"Per capita calorie intake\",\"Log of per capita calorie intake\"),\n se=list(NULL,robust_se,robust_se2),\n omit=\"state\",\n model.numbers=FALSE,\n report = \"vct*\",\n single.row=TRUE,\n omit.labels = \"State and region dummies\")" ((:colname-names) (:rowname-names) (:result-params "replace" "scalar" "latex") (:result-type . value) (:comments . "") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . "no") (:exports . "results") (:results . "replace scalar latex") (:hlines . "no") (:session . "type2")))
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)
> On 30-May-2016, at 6:48 am, Charles C. Berry <ccberry@ucsd.edu> wrote:
>
> On Sun, 29 May 2016, Vikas Rawal wrote:
>
>>
>>>
>>> Vikas, can you edit the `sit-for' to `sleep-for' in
>>>
>>> `org-babel-comint-eval-invisibly-and-wait-for-file'
>>>
>>> and `eval-defun' the result and see if that has any effect?
>>>
>>
>
>> Sorry, given my limited ability with lisp, I do not really
>> understand. Could you please spell out what do I have to do.
>
> Vikas,
>
> Copy the src-block at bottom to a *.org file or org-mode buffer. Then
> execute it with `C-c C-c y'.
>
> You should see
>
> #+RESULTS:
> : org-babel-comint-eval-invisibly-and-wait-for-file
>
> appear afterwards.
>
> Then try running your R code to see if it works reliably.
>
> Does that seem to fix it?
>
> If not, please check the session buffer to see if there were any
> warnings or errors.
>
> Chuck
>
>
> #+BEGIN_SRC emacs-lisp
> (defun org-babel-comint-eval-invisibly-and-wait-for-file
> (buffer file string &optional period)
> "Evaluate STRING in BUFFER invisibly.
> Don't return until FILE exists. Code in STRING must ensure that
> FILE exists at end of evaluation."
> (unless (org-babel-comint-buffer-livep buffer)
> (error "Buffer %s does not exist or has no process" buffer))
> (if (file-exists-p file) (delete-file file))
> (process-send-string
> (get-buffer-process buffer)
> (if (= (aref string (1- (length string))) ?\n) string (concat string "\n")))
> ;; From Tramp 2.1.19 the following cache flush is not necessary
> (if (file-remote-p default-directory)
> (with-parsed-tramp-file-name default-directory nil
> (tramp-flush-directory-property v "")))
> (while (not (file-exists-p file)) (sleep-for (or period 0.25))))
>
> #+END_SRC
next prev parent reply other threads:[~2016-05-30 10:25 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 [this message]
2016-05-30 16:22 ` Charles C. Berry
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=84824898-5690-4956-A4C6-EC20872896A6@agrarianresearch.org \
--to=vikaslists@agrarianresearch.org \
--cc=ccberry@ucsd.edu \
--cc=emacs-orgmode@gnu.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.