From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: [PATCH] -for review- Tangling with variable transfer of variables Date: Thu, 19 Jun 2014 22:19:49 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxioY-0008Ls-Jr for emacs-orgmode@gnu.org; Thu, 19 Jun 2014 16:20:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WxioS-000575-4F for emacs-orgmode@gnu.org; Thu, 19 Jun 2014 16:20:06 -0400 Received: from mail-wg0-f44.google.com ([74.125.82.44]:47321) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WxioR-00056t-U8 for emacs-orgmode@gnu.org; Thu, 19 Jun 2014 16:20:00 -0400 Received: by mail-wg0-f44.google.com with SMTP id x13so2802139wgg.27 for ; Thu, 19 Jun 2014 13:19:59 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: Eric Schulte --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-lisp-ob-R.el-Fix-tangling-with-tables.patch Content-Transfer-Encoding: quoted-printable Content-Description: Patch From=20f77e982e17909f2098974356c304bd29db04da79 Mon Sep 17 00:00:00 2001 From: "Rainer M. Krug" 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. =2D-- 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 =2D-- a/lisp/ob-R.el +++ b/lisp/ob-R.el @@ -190,25 +190,20 @@ This function is called by `org-babel-execute-src-blo= ck'." (if (listp value) (let* ((lengths (mapcar 'length (org-remove-if-not 'sequencep value)= )) (max (if lengths (apply 'max lengths) 0)) =2D (min (if lengths (apply 'min lengths) 0)) =2D (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))) =2D (with-temp-file transition-file =2D (insert =2D (orgtbl-to-tsv value '(:fmt org-babel-R-quote-tsv-field)) =2D "\n")) =2D (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 (=3D max min) =2D (format "%s <- read.table(\"%s\", + (format "%s <- read.table(textConnection('%s'), header=3D%s, row.names=3D%s, sep=3D\"\\t\", as.is=3DTRUE)" name file header row-names) =2D (format "%s <- read.table(\"%s\", + (format "%s <- read.table(textConnection('%s'), header=3D%s, row.names=3D%s, sep=3D\"\\t\", =2D-=20 2.0.0 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Cheers, Rainer =2D-=20 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: Rainer@krugs.de Skype: RMkrug PGP: 0x0F52F982 --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) iQEcBAEBAgAGBQJTo0XqAAoJENvXNx4PUvmCXVAH/jsis+quV5gdLYra3NM9eUu4 3JV1xqn9YQsMPNIcy0hBGb4YONPmeuUdXVuMgpMRFwxcIU3HnfujCq2mFqZwxjpU lEJTsOmbyYMP358KRFFcaKQngh8qqxUgVzi8wV0LA9DD6a51evc693zT4EV3Yrx3 UJEtaIeHjvJJZgsezry2NkCQgpHl4JQl0DhYG44/QH1UtfopACohGOSZHPY34rwa SgF/W8ulfBxyhxLl3qBFuwy/hs9KS4NXj+CtMFDlqoKVGjVdmrcwki28RIHrdcxK OjxgwnQXI/uzd0tTtsiylXzwaWf1Y/OBgxpw+gh/H1g71FFFzqshpP6IeEY6cs0= =IbVb -----END PGP SIGNATURE----- --==-=-=--