[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [BUG] ob-R.el: extra empty data.frame columns generated from plain l
From: |
Berry, Charles |
Subject: |
Re: [BUG] ob-R.el: extra empty data.frame columns generated from plain lists after recent change [9.6 (release_9.6-3-ga4d38e @ /usr/share/emacs/30.0.50/lisp/org/)] |
Date: |
Mon, 5 Dec 2022 18:57:11 +0000 |
> On Dec 4, 2022, at 6:43 PM, Greg Minshall <minshall@umich.edu> wrote:
>
> i see this same behavior. to me, (org-babel-R-assign-elisp) seems to be
> the problem, but it hasn't changed any time recently. (nor, if my =git
> blame= is done correctly, has anything else in ob-R.el.)
>
> i don't understand how (org-babel-R-assign-elisp) thinks. it seems to
> assign =max= and =min= assuming that =value= is a list of (at least one)
> list(s).
>
> this *might* be a fix. but, i don't have a lot of confidence it will
> not have bad side effects for other cases. (though i tested it with a
> simple list, and a simple table with more than one row, and a list of
> two lists, the first of length 3, the second of length 2.):
> ----
> modified lisp/ob-R.el
> @@ -241,7 +241,7 @@ This function is called by `org-babel-execute-src-block'."
> (defun org-babel-R-assign-elisp (name value colnames-p rownames-p)
> "Construct R code assigning the elisp VALUE to a variable named NAME."
> (if (listp value)
> - (let* ((lengths (mapcar 'length (cl-remove-if-not 'sequencep value)))
> + (let* ((lengths (mapcar 'length (cl-remove-if-not 'listp value)))
> (max (if lengths (apply 'max lengths) 0))
> (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)))
+ (unless (listp (car value)) (setq value (mapcar 'list value)))
> ----
This makes a list like '("a" "b" "c") into a data.frame with one column.
HTH,
Chuck
Re: [BUG] ob-R.el: extra empty data.frame columns generated from plain lists after recent change [9.6 (release_9.6-3-ga4d38e @ /usr/share/emacs/30.0.50/lisp/org/)], Greg Minshall, 2022/12/04