فهرست منبع

R evaluation is pretty much up to snuff

Eric Schulte 16 سال پیش
والد
کامیت
82e7c86ea3
2فایلهای تغییر یافته به همراه21 افزوده شده و 16 حذف شده
  1. 3 6
      lisp/org-babel-R.el
  2. 18 10
      org-babel.org

+ 3 - 6
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)

+ 18 - 10
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