emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tsd@tsdye.com (Thomas S. Dye)
To: Eric Luo <eric.wenbl@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: was this intentional with the default header ":results value"
Date: Sat, 14 Jul 2012 06:44:15 -1000	[thread overview]
Message-ID: <m1zk729tsw.fsf@tsdye.com> (raw)
In-Reply-To: <87pq7zhh75.fsf@gmail.com> (Eric Luo's message of "Fri, 13 Jul 2012 22:24:46 +0800")

Aloha Eric,

Eric Luo <eric.wenbl@gmail.com> writes:

> Hi, 
> Why in the following code block, c1 was printed as scientific notation
> rather then characters.
> ,----
> | 
> | #+BEGIN_SRC R :results value
> |   df <- data.frame(c1="123456789123456789",c2=2)
> | #+END_SRC
> | 
> | #+RESULTS:
> | | 1.2345678912345678e+17 | 2 |
> `----

With :results value the results are passed from the source language into
emacs-lisp and then displayed in the buffer.  So, the representation of
things like very large numbers depends on how that was done in
emacs-lisp, independent of the source language conventions.  In this
case, I suspect the number was written with a formatting string and ‘%g’
which uses scientific notation if that is a shorter representation.


> But if the header :results output, the result was expected.
> ,----
> | 
> | #+BEGIN_SRC R :results output 
> |   df <- data.frame(c1="123456789123456789",c2=2)
> |   df
> | #+END_SRC
> | 
> | #+RESULTS:
> | :                   c1 c2
> | : 1 123456789123456789  2
> `----
>

With :results output the results aren't translated into emacs-lisp.
Instead, the output from the source language is collected and displayed
in the buffer.  Thus, the output conventions of the source language are
respected. 

hth,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

  reply	other threads:[~2012-07-14 16:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-13 14:24 was this intentional with the default header ":results value" Eric Luo
2012-07-14 16:44 ` Thomas S. Dye [this message]
2012-07-15  1:00   ` Eric Luo
2012-07-15  3:33     ` Thomas S. Dye
2012-07-15  3:54       ` Thomas S. Dye
2012-07-15  9:18         ` Eric Luo

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=m1zk729tsw.fsf@tsdye.com \
    --to=tsd@tsdye.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=eric.wenbl@gmail.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).