Aaron Ecay writes: > 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-block'." > (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-tsv-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.) That looks like it would work. > >> ,---- >> | ... >> | sep = \"\", ;;;;;<<<<<<<<< was before sep = \"\\t\" >> | ... >> `---- >> >> 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 – see the > “Details” section of ?scan in R for the gory details (beginning with “If > ‘sep’ is the default”...). I agree completely - it would not be a final solution but possibly solve the problem temporarily in an emacs.org file. But the real question is: why are on some setups the tabs converted to spaces? > > 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. Might be a solution - but I do not know how commas are working under different locales. In MS Office, a csv file is a semicolon (;) separated file when in the chosen language settings a comma is used as decimal separator - and and I have no idea if language settings affect emacs in the same way (I actually don't hope so). This makes me think - why not use "|" as a separator (as it is the case in org)? In this way, all tables which are in org can be directly given to R as strings without the hassle of to much of conversion? Rainer > > Andreas’s original report (also referenced earlier in this thread): > http://news.gmane.org/find-root.php?message_id=olulhmmtei5.fsf%40med.uni%2dgoettingen.de > > Thanks, -- Rainer M. Krug email: Rainerkrugsde PGP: 0x0F52F982