[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] [PATCH] -for review- Tangling with variable transfer of variables
From: |
Rainer M Krug |
Subject: |
[O] [PATCH] -for review- Tangling with variable transfer of variables |
Date: |
Thu, 19 Jun 2014 22:19:49 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) |
Hi
This patch should fix the problem of tangling with variable transfer of
tables. It uses a textConection() instead of a file to transfer the
table. This results in variable transfer of variables in R, without
having to include additional files.
Hope this does not work only for me.
From f77e982e17909f2098974356c304bd29db04da79 Mon Sep 17 00:00:00 2001
From: "Rainer M. Krug" <address@hidden>
Date: Thu, 19 Jun 2014 22:03:46 +0200
Subject: [PATCH] lisp/ob-R.el: Fix tangling with tables
* lisp/ob-R.el (org-babel-R-assign-elisp): Fix variable transfer of
tables by using text connections in R instead of files. Variable
transfer of tables does not depend on files anymore, i.e. works also
when tangling.
---
lisp/ob-R.el | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/lisp/ob-R.el b/lisp/ob-R.el
index a3ae1ec..88f65f3 100644
--- a/lisp/ob-R.el
+++ b/lisp/ob-R.el
@@ -190,25 +190,20 @@ This function is called by `org-babel-execute-src-block'."
(if (listp value)
(let* ((lengths (mapcar 'length (org-remove-if-not 'sequencep value)))
(max (if lengths (apply 'max lengths) 0))
- (min (if lengths (apply 'min lengths) 0))
- (transition-file (org-babel-temp-file "R-import-")))
+ (min (if lengths (apply 'min lengths) 0)))
;; Ensure VALUE has an orgtbl structure (depth of at least 2).
(unless (listp (car value)) (setq value (list value)))
- (with-temp-file transition-file
- (insert
- (orgtbl-to-tsv value '(:fmt org-babel-R-quote-tsv-field))
- "\n"))
- (let ((file (org-babel-process-file-name transition-file 'noquote))
+ (let ((file (orgtbl-to-tsv value '(:fmt org-babel-R-quote-tsv-field)))
(header (if (or (eq (nth 1 value) 'hline) colnames-p)
"TRUE" "FALSE"))
(row-names (if rownames-p "1" "NULL")))
(if (= max min)
- (format "%s <- read.table(\"%s\",
+ (format "%s <- read.table(textConnection('%s'),
header=%s,
row.names=%s,
sep=\"\\t\",
as.is=TRUE)" name file header row-names)
- (format "%s <- read.table(\"%s\",
+ (format "%s <- read.table(textConnection('%s'),
header=%s,
row.names=%s,
sep=\"\\t\",
--
2.0.0
Cheers,
Rainer
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)
Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa
Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax : +33 - (0)9 58 10 27 44
Fax (D): +49 - (0)3 21 21 25 22 44
email: address@hidden
Skype: RMkrug
PGP: 0x0F52F982
pgps76myOD848.pgp
Description: PGP signature
- [O] [PATCH] -for review- Tangling with variable transfer of variables,
Rainer M Krug <=
- Re: [O] [PATCH] -for review- Tangling with variable transfer of variables, Aaron Ecay, 2014/06/19
- Re: [O] [PATCH] -for review- Tangling with variable transfer of variables, Charles Berry, 2014/06/19
- Re: [O] [PATCH] -for review- Tangling with variable transfer of variables, Rainer M Krug, 2014/06/20
- Re: [O] [PATCH] -for review- Tangling with variable transfer of variables, Rainer M Krug, 2014/06/20
- Re: [O] [PATCH] -for review- Tangling with variable transfer of variables, Charles C. Berry, 2014/06/21
- Re: [O] [PATCH] -for review- Tangling with variable transfer of variables, Aaron Ecay, 2014/06/21
- Re: [O] [PATCH] -for review- Tangling with variable transfer of variables, Rainer M Krug, 2014/06/23
- Re: [O] [PATCH] -for review- Tangling with variable transfer of variables, Rainer M Krug, 2014/06/23
- Re: [O] [PATCH] -for review- Tangling with variable transfer of variables, Rainer M Krug, 2014/06/23
- Re: [O] [PATCH] -for review- Tangling with variable transfer of variables, Charles C. Berry, 2014/06/23