From 2cc09a20297d6b6e1ae83ceb0d34ae692758bd19 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Wed, 20 May 2009 17:48:47 -0700 Subject: [PATCH] temporarily deferred "use textConnection to pass tsv to R" --- rorg.org | 63 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/rorg.org b/rorg.org index 3faa9e59c..2f1bfe42c 100644 --- a/rorg.org +++ b/rorg.org @@ -3,42 +3,13 @@ #+SEQ_TODO: TODO OPEN PROPOSED | DONE DEFERRED REJECTED #+STARTUP: oddeven -* Tasks [10/20] +* Tasks [11/20] ** TODO results-type header (scalar/vector) In response to a point in Dan's email. We should allow the user to force scalar or vector results. This could be done with a header argument, and the default behavior could be controlled through a configuration variable. -** TODO use textConnection to pass tsv to R? - When passing args from the org buffer to R, the following route is - used: arg in buffer -> elisp -> tsv on file -> data frame in R. I - think it would be possible to avoid having to write to file by - constructing an R expression in litorgy-R-assign-elisp, something - like this - -#+begin_src emacs-lisp -(litorgy-R-input-command - (format "%s <- read.table(textConnection(\"%s\"), sep=\"\\t\", as.is=TRUE)" - name (orgtbl-to-tsv value '(:sep "\t" :fmt litorgy-R-quote-tsv-field)))) -#+end_src - - I haven't tried to implement this yet as it's basically just - fiddling with something that works. The only reason for it I can - think of would be efficiency and I haven't tested that. - - [Eric] Sounds like a good idea, I'll bump this up to TODO. Didn't - work after an initial test, but still worth trying. - -for quick tests - -#+tblname: quick-test -| 1 | 2 | 3 | - -#+begin_src R :var vec=quick-test -mean(mean(vec)) -#+end_src - ** TODO re-implement R evaluation using ess-command or ess-execute I don't have any complaints with the current R evaluation code or behaviour, but I think it would be good to use the ESS functions @@ -198,6 +169,38 @@ one that comes to mind is the ability to treat a source-code block like a function which accepts arguments and returns results. Actually this can be it's own TODO (see [[* source blocks as functions][source blocks as functions]]). +** DEFERRED use textConnection to pass tsv to R? + When passing args from the org buffer to R, the following route is + used: arg in buffer -> elisp -> tsv on file -> data frame in R. I + think it would be possible to avoid having to write to file by + constructing an R expression in litorgy-R-assign-elisp, something + like this + +#+begin_src emacs-lisp +(litorgy-R-input-command + (format "%s <- read.table(textConnection(\"%s\"), sep=\"\\t\", as.is=TRUE)" + name (orgtbl-to-tsv value '(:sep "\t" :fmt litorgy-R-quote-tsv-field)))) +#+end_src + + I haven't tried to implement this yet as it's basically just + fiddling with something that works. The only reason for it I can + think of would be efficiency and I haven't tested that. + + This Didn't work after an initial test. I still think this is a + good idea (I also think we should try to do something similar when + writing out results frmo R to elisp) however as it wouldn't result + in any functional changes I'm bumping it down to deferred for + now. [Eric] + +for quick tests + +#+tblname: quick-test +| 1 | 2 | 3 | + +#+begin_src R :var vec=quick-test +mean(mean(vec)) +#+end_src + ** DONE litorgy tests litorgy [1/1] since we are accumulating this nice collection of source-code blocks in the sandbox section we should make use of them as unit tests.