emacs-orgmode
[Top][All Lists]
Advanced

[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: Greg Minshall
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, 14 Dec 2022 05:53:45 +0300

hi, Johan,

> "Proper list" in the context of this discussion and pertaining to R
> would be a =list()=, not a vector which is what is usually returned by
> =c()=. A =data.frame()= is a special case of a =list()= where every
> column has to have the same length.

well, it's a language mapping problem.  what one considers a "list" in
org-mode is
- well
- something like
- this
  - maybe with
  - this

whereas in e-lisp, '("well" "something like" '("this" '("maybe with"
"this"))).

then, the question arises of how to translate something like that to
whatever data structures a given programming language offers.  it
*might* be to something that programming language calls a "list".

if we are ignoring "sub lists", then for R, one could argue either
vectors or lists.  (someone -- possibly you? -- pointed out that going
from an R list to a vector is as simple as an unlist() call.)

if we ever want to provide support for sub lists, then passing lists as
R lists seems like the way to go.

cheers, Greg
----

> list("well", "something like", list("this", list("maybe with")))
[[1]]
[1] "well"

[[2]]
[1] "something like"

[[3]]
[[3]][[1]]
[1] "this"

[[3]][[2]]
[[3]][[2]][[1]]
[1] "maybe with"



> unlist(list("well", "something like", list("this", list("maybe with"))))
[1] "well"           "something like" "this"           "maybe with"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]