From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: Wrong results from R source block when returning a list Date: Tue, 3 Nov 2015 08:59:56 -0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtewF-00044k-L6 for emacs-orgmode@gnu.org; Tue, 03 Nov 2015 12:00:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZtewA-0000gN-HJ for emacs-orgmode@gnu.org; Tue, 03 Nov 2015 12:00:03 -0500 Received: from iport-acv6-out.ucsd.edu ([132.239.0.13]:10899) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZtewA-0000gJ-8T for emacs-orgmode@gnu.org; Tue, 03 Nov 2015 11:59:58 -0500 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Rainer M Krug Cc: emacs-orgmode@gnu.org 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