From: "Charles C. Berry" <ccberry@ucsd.edu>
To: Sebastien Vauban <sva-news@mygooglest.com>
Cc: public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org
Subject: Re: Adding `sort' in R makes the output fail
Date: Thu, 23 Oct 2014 13:04:44 -0700 [thread overview]
Message-ID: <alpine.OSX.2.00.1410231244310.899@charles-berrys-macbook.local> (raw)
In-Reply-To: <86y4s6wri1.fsf@example.com>
On Thu, 23 Oct 2014, Sebastien Vauban wrote:
> "Charles C. Berry" wrote:
>> On Thu, 23 Oct 2014, Sebastien Vauban wrote:
>>>
>>> The following code does return a corrupted answer, while it's supposed
>>> to return a sorted dataframe.
>>
>> Not so. See below.
>
> So, that's RStudio that's wrong, in some way?
>
Hmmm. Not exactly wrong.
There are a few wrinkles:
org-babel-R-write-object-command specifies a call to
'write.table(object)', where `object' is what is to be printed.
`write.table' coerces whatever it is trying to print to a
`data.frame'. See ?write.table
There is a method for `table' in `as.data.frame'. Try
as.data.frame(table(1:3))
in the console or R gui to get a sense of what happens.
There is also an `array' method for `as.data.frame', but with a one
dimensional array it passes control to the `vector' method. Try:
as.data.frame(sort(table(1:3)))
So it is really differences in the result of as.data.frame() that you were
seeing.
I DK what RStudio does, but it must try harder a little harder to present
1 dimensional arrays.
HTH,
Chuck
prev parent reply other threads:[~2014-10-23 20:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-23 14:37 Adding `sort' in R makes the output fail Sebastien Vauban
[not found] ` <alpine.OSX.2.00.1410230848520.460@charles-berrys-macbook.local>
[not found] ` <alpine.OSX.2.00.1410230848520.460-iDQ3frm8jJiryYnjg5slPZa4wMfmKMrbhPhL2mjWHbk@public.gmane.org>
2014-10-23 18:49 ` Sebastien Vauban
2014-10-23 20:04 ` Charles C. Berry [this message]
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.00.1410231244310.899@charles-berrys-macbook.local \
--to=ccberry@ucsd.edu \
--cc=public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org \
--cc=sva-news@mygooglest.com \
/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).