From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: Re: org tables into R? Date: Tue, 06 Jan 2015 12:49:25 -0500 Message-ID: <87lhlfvly2.fsf@gmail.com> References: <874ms6w0it.fsf@gmail.com> <87zj9xa1ni.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47301) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y8YG3-0005MK-RL for emacs-orgmode@gnu.org; Tue, 06 Jan 2015 12:49:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y8YFz-0002HM-Jg for emacs-orgmode@gnu.org; Tue, 06 Jan 2015 12:49:31 -0500 Received: from mail-qc0-x236.google.com ([2607:f8b0:400d:c01::236]:34455) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y8YFz-0002H6-Gc for emacs-orgmode@gnu.org; Tue, 06 Jan 2015 12:49:27 -0500 Received: by mail-qc0-f182.google.com with SMTP id r5so17514501qcx.27 for ; Tue, 06 Jan 2015 09:49:27 -0800 (PST) In-Reply-To: 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: Rainer M Krug , Andreas Leha Cc: emacs-orgmode@gnu.org Hi Rainer and Andreas, 2015ko urtarrilak 6an, Rainer M Krug-ek idatzi zuen: > What would definitely solve the issue is if the string containing the > tabs would use \t instead - but I have no idea how this could be > achieved easily. This could be achieved by modifying the call to orgtbl-to-csv in org-babel-R-assign-elisp: diff --git i/lisp/ob-R.el w/lisp/ob-R.el index 6f76aa5..ec3f110 100644 --- i/lisp/ob-R.el +++ w/lisp/ob-R.el @@ -239,7 +239,10 @@ This function is called by `org-babel-execute-src-bloc= k'." (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))) - (let ((file (orgtbl-to-tsv value '(:fmt org-babel-R-quote-tsv-field= ))) + (let ((file (replace-regexp-in-string + "\t" "\\t" + (orgtbl-to-tsv value '(:raw t :fmt org-babel-R-quote-t= sv-field)) + nil t)) (header (if (or (eq (nth 1 value) 'hline) colnames-p) "TRUE" "FALSE")) (row-names (if rownames-p "1" "NULL"))) (This is just a quick hack; if it works then the code should actually use orgtbl-to-generic to do the conversion in a single step.) > ,---- > | ...=20=20 > | sep =3D \"\", ;;;;;<<<<<<<<< was before sep =3D \"\\t\" > | ... > `---- >=20 > This will set the separator to "whitespace", i.e. "that is one or more > spaces, tabs, newlines or carriage returns" (from R help). This was the approach that Michael took in his original patch. It introduces new bugs related to the handling of quotes, though =E2=80=93 see= the =E2=80=9CDetails=E2=80=9D section of ?scan in R for the gory details (begin= ning with =E2=80=9CIf =E2=80=98sep=E2=80=99 is the default=E2=80=9D...). Andreas raised a bug a while ago that indicates to me that this code should switch to csv rather than a whitespace-delimited format. But there are lots of corner cases, and I have not had time to work on a patch that I am confident could cover them all. Andreas=E2=80=99s original report (also referenced earlier in this thread): http://news.gmane.org/find-root.php?message_id=3Dolulhmmtei5.fsf%40med.uni%= 2dgoettingen.de Thanks, --=20 Aaron Ecay