emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Charles C. Berry" <ccberry@ucsd.edu>
To: Rainer M Krug <Rainer@krugs.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: Wrong results from R source block when returning a list
Date: Tue, 3 Nov 2015 08:59:56 -0800	[thread overview]
Message-ID: <alpine.OSX.2.20.1511030837410.725@charles-berrys-macbook.local> (raw)
In-Reply-To: <m2si4nmgje.fsf@krugs.de>

On Tue, 3 Nov 2015, Rainer M Krug wrote:

> Hi
>
> The following code block returns a wrong table / list:
>
>
> #+begin_src R :results value list
> list(1:10, 1:5)
> #+end_src
>
> #+RESULTS:
> - (1 1)
> - (2 2)
> - (3 3)
> - (4 4)
> - (5 5)
> - (6 1)
> - (7 2)
> - (8 3)
> - (9 4)
> - (10 5)
>
> The result is actually in R:


In particular in `org-babel-R-write-object-command' which uses 
write.table() which uses as.data.frame() which dispatches to 
as.data.frame.list() which calls data.frame() where the recycling occurs.

[snip]

> I have no idea if this is a bug or wrong result due to incompatible
> types (R list and org table)?

If you can't coerce a non-atomic R object to a data.frame and get a 
pleasing result, you need to craft your own solution.

>
> Is this mentioned in the manual?

Not that I know of. A comment in `Results Types' in ob-doc-R -

http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.html#orgheadline6

- might be helpful.

Chuck

  reply	other threads:[~2015-11-03 17:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-03 12:08 Wrong results from R source block when returning a list Rainer M Krug
2015-11-03 16:59 ` Charles C. Berry [this message]
2015-11-05 11:06   ` Rainer M Krug

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=alpine.OSX.2.20.1511030837410.725@charles-berrys-macbook.local \
    --to=ccberry@ucsd.edu \
    --cc=Rainer@krugs.de \
    --cc=emacs-orgmode@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).