From 82e7c86ea3ecad51839f81ca820fb12fcac53f26 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Fri, 12 Jun 2009 08:29:21 -0700 Subject: [PATCH] R evaluation is pretty much up to snuff --- lisp/org-babel-R.el | 9 +++------ org-babel.org | 28 ++++++++++++++++++---------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/lisp/org-babel-R.el b/lisp/org-babel-R.el index 583d072d1..ef63da894 100644 --- a/lisp/org-babel-R.el +++ b/lisp/org-babel-R.el @@ -126,11 +126,8 @@ last statement in BODY." (accept-process-output (get-buffer-process buffer))) ;; remove filter (remove-hook 'comint-output-filter-functions 'my-filt)) - ;; ;;; debugging - ;; ;; echo raw results - ;; (message (format "raw-results=%S" string-buffer)) + ;; (message (format "raw-results=%S" string-buffer)) ;; debugging ;; ;; split results - (message (format "split-results=%S" (split-string string-buffer comint-prompt-regexp))) ;; split results with `comint-prompt-regexp' (setq results (let ((broke nil)) (delete nil (mapcar (lambda (el) @@ -144,8 +141,8 @@ last statement in BODY." el)))) (mapcar #'org-babel-trim (split-string string-buffer comint-prompt-regexp)))))) (case result-type - (output (mapconcat #'identity results "\n")) - (value (with-temp-buffer (insert-file-contents tmp-file) (buffer-string))) + (output (org-babel-trim (mapconcat #'identity results "\n"))) + (value (org-babel-trim (with-temp-buffer (insert-file-contents tmp-file) (buffer-string)))) (t (reverse results)))))) (provide 'org-babel-R) diff --git a/org-babel.org b/org-babel.org index 469a6694c..5f6869766 100644 --- a/org-babel.org +++ b/org-babel.org @@ -522,36 +522,32 @@ schulte + 3 schulte #+end_src -**** TODO R [3/5] +**** TODO R [4/5] - [X] functional results working with comint - [X] script results - [X] ensure scalar/vector results args are taken into consideration -- [ ] ensure callable by other source block +- [X] ensure callable by other source block - [ ] rename buffer after session To redirect output to a file, you can use the =sink()= command. #+srcname: task_R_B -#+begin_src R :results replace value vector +#+begin_src R :results value vector silent a <- 9 b <- 10 b - a a + b #+end_src -#+resname: task_R_B -| 19 | - #+srcname: task-R-use-other-output #+begin_src R :var twoentyseven=task_R_B() :results replace value 83 -twoentyseven +twoentyseven + 9 #+end_src #+resname: task-R-use-other-output -| "[1]" | 1 | -| "[1]" | 19 | +: 28 **** TODO Python @@ -1526,7 +1522,19 @@ This could probably be added to [[file:lisp/org-babel-script.el][org-babel-scrip (see [[* file result types][file result types]]) -* Bugs [11/14] +* Bugs [11/15] + +** TODO when reading results from =#+resname= line + +Errors when trying to read from resname lines. + +#+resname: bug-in-resname +: 8 + +#+srcname: bug-in-resname-reader +#+begin_src emacs-lisp :var buggy=bug-in-resname() :results silent +buggy +#+end_src ** TODO non-orgtbl formatted lists for example