From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rainer M Krug Subject: Re: Wrong results from R source block when returning a list Date: Thu, 05 Nov 2015 12:06:26 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44791) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuINK-0002uy-U2 for emacs-orgmode@gnu.org; Thu, 05 Nov 2015 06:06:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZuING-00055c-Ha for emacs-orgmode@gnu.org; Thu, 05 Nov 2015 06:06:38 -0500 Received: from mail-wm0-f54.google.com ([74.125.82.54]:36871) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuING-00055S-BM for emacs-orgmode@gnu.org; Thu, 05 Nov 2015 06:06:34 -0500 Received: by wmll128 with SMTP id l128so10157517wml.0 for ; Thu, 05 Nov 2015 03:06:33 -0800 (PST) In-Reply-To: (Charles C. Berry's message of "Tue, 3 Nov 2015 08:59:56 -0800") 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: "Charles C. Berry" Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable "Charles C. Berry" writes: > 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. Thanks for this info - I thought something along these lines, but this makes it clear why. > > [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. Yup - I did it in R > >> >> 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#orghead= line6 > > - might be helpful. Yes - thanks, Rainer > > Chuck =2D-=20 Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,= UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: Rainer@krugs.de Skype: RMkrug PGP: 0x0F52F982 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBCAAGBQJWOzg2AAoJENvXNx4PUvmCA/EH/3UNY7Uv03/zA9udKwjKmMQq ld+KlPgNFBH/jhXNVa/5O7n4h26ywAiC0Q/VTy51yeLVfHkXzmyT5D2TCRpjQ7T6 DUDk4ZRrwlmxW7yqiNCosjMoismJ5kNmiE9uRFkMhZUg/9jVALjWx87n6WEeMOKU 83TSdZxS3vjO5GH+OH5vSFo0hdyPorMTc8kUyw0mHs8EETvYEa25ITjQVdN3SiCK gU4CA7/XrfDsX2cBdoFHEemRa4Q5Mb/u8fyxdphbRJAkjaPbE4SbCpcOER7UxJiy bD9wMXZgGXz8fv5y1dDIj/Pcgdab4lp6a1f6uqzUImjKwvGkceNsY0qBLqjSVqs= =4tmI -----END PGP SIGNATURE----- --=-=-=--