[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] was this intentional with the default header ":results value"
From: |
Thomas S. Dye |
Subject: |
Re: [O] was this intentional with the default header ":results value" |
Date: |
Sat, 14 Jul 2012 06:44:15 -1000 |
Aloha Eric,
Eric Luo <address@hidden> 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