all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Jeremie Juste <jeremiejuste@gmail.com>
Cc: "Greg Minshall" <minshall@umich.edu>,
	"Johan Tolö" <johan@toloe.se>,
	emacs-orgmode@gnu.org, "Berry, Charles" <ccberry@health.ucsd.edu>
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: Wed, 07 Dec 2022 12:16:28 +0000	[thread overview]
Message-ID: <87bkofh0ir.fsf@localhost> (raw)
In-Reply-To: <87wn74xjv7.fsf@gmail.com>

Jeremie Juste <jeremiejuste@gmail.com> writes:

> Many thanks for the insights. I confess that I have never transferred
> list from org to R before. I've always use tables and as far as I
> understand they works fine in 9.6.
>
> So assuming this list
>
> #+name: alist 
> - first item
> - second item
> - third item
>   - 3.1 item
> - fourth item
>
>
> before c72d5ee84 we could do something like 
>
> #+begin_src R :var list=alist
>   list
> #+end_src
>
> #+RESULTS:
> | first item  |                        |
> | second item |                        |
> | third item  | (unordered (3.1 item)) |
> | fourth item |                        |

And it was a bug that the ob-core patch fixed.
Unfortunately, a number of babel backends also developed workarounds
meanwhile.

For the context, the ground truth is Org manual:

16.4 Environment of a Code Block

    list
         A simple named list.
    
              #+NAME: example-list
              - simple
                - not
                - nested
              - list
    
              #+BEGIN_SRC emacs-lisp :var x=example-list
                (print x)
              #+END_SRC
    
              #+RESULTS:
              | simple | list |
    
         Note that only the top level list items are passed along.  Nested
         list items are ignored.

> and after we end up with 
>
>
> #+begin_src R :var list=alist
>   list
> #+end_src
>
> #+RESULTS:
> | first item | second item | third item | fourth item |   |   |   |   |   |   |
>
> Here I'm on uncharted territory. We could go with 
> 1.
> | first item | second item | third item | fourth item |
>
> or be closer to the version 9.5 with
> 2. 
> | first item  | 
> | second item | 
> | third item  | 
> | fourth item | 
>
> However I'm still tempted to choose the second option to break as little
> workflow as possible.
>
> If we go in this direction the solution of Chuck works fine. Many thanks
> for the suggestions.

I also like the second option as **printing** more, but it is _not_ what
we have in the manual.

Note that the origin of the issue is in how list=alist is assigned.

Before the problematic commit, we had awkward situation when
alist=(("first item") ("second item") ...)

I changed things to
alist=("first item" "second item" ...)
which makes a lot more sense when passed as variable value.

Now, printing:

ob-core prints lists as a special case of tables.
Since ("first item" "second item" ...) is a row vector, we get
| first item | second item | ... |

changing row vectors to be printed as column vectors is easy, but I am
afraid about non-trivial breakage.


Hope the above clarifies about what happened and why I changes things
like I did.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


  parent reply	other threads:[~2022-12-07 12:17 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-04 14:34 [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/)] Johan Tolö
2022-12-05  2:43 ` Greg Minshall
2022-12-05 10:29   ` Johan Tolö
2022-12-05 11:21     ` Jérémie Juste
2022-12-05 18:57   ` Berry, Charles
2022-12-06  0:41     ` Greg Minshall
2022-12-06  4:31       ` Berry, Charles
2022-12-06  6:52         ` Greg Minshall
2022-12-05  2:49 ` Greg Minshall
2022-12-06 22:11   ` Jeremie Juste
2022-12-07  1:31     ` Greg Minshall
2022-12-07  1:53       ` William Denton
2022-12-07 12:16     ` Ihor Radchenko [this message]
2022-12-07 21:08       ` Jeremie Juste
2022-12-08  9:07         ` Ihor Radchenko
2022-12-08 12:42           ` Greg Minshall
2022-12-08 12:51             ` Ihor Radchenko
2022-12-08 13:33               ` Greg Minshall
2022-12-10 12:31               ` Johan Tolö
2022-12-11  8:51                 ` [FR] Allow passing nested list structures to variables in src blocks (was: [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/)]) Ihor Radchenko
2022-12-11 15:31           ` [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/)] Jeremie Juste
2022-12-12  9:47             ` Ihor Radchenko
2022-12-12 12:17               ` Greg Minshall
2022-12-12 12:27                 ` Ihor Radchenko
2022-12-13 13:29                 ` Johan Tolö
2022-12-14  2:53                   ` Greg Minshall
2022-12-15  8:51                     ` Johan Tolö
2022-12-15 17:50                       ` Greg Minshall
2022-12-29 16:00               ` Bastien Guerry
2022-12-29 23:52                 ` Berry, Charles
2022-12-30  9:25                   ` Bastien
2022-12-31 12:42                   ` Ihor Radchenko
2022-12-30  9:24               ` Bastien Guerry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bkofh0ir.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=ccberry@health.ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=jeremiejuste@gmail.com \
    --cc=johan@toloe.se \
    --cc=minshall@umich.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.