From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Luo Subject: Re: was this intentional with the default header ":results value" Date: Sun, 15 Jul 2012 09:00:09 +0800 Message-ID: <87d33xn8iu.fsf@gmail.com> References: <87pq7zhh75.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:59378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SqDCp-0003E3-24 for emacs-orgmode@gnu.org; Sat, 14 Jul 2012 21:01:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SqDCo-0004or-0H for emacs-orgmode@gnu.org; Sat, 14 Jul 2012 21:01:02 -0400 Received: from plane.gmane.org ([80.91.229.3]:39096) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SqDCn-0004on-K2 for emacs-orgmode@gnu.org; Sat, 14 Jul 2012 21:01:01 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1SqDCl-00089J-TZ for emacs-orgmode@gnu.org; Sun, 15 Jul 2012 03:00:59 +0200 Received: from 59.175.187.106 ([59.175.187.106]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 15 Jul 2012 03:00:59 +0200 Received: from eric.wenbl by 59.175.187.106 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 15 Jul 2012 03:00:59 +0200 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: emacs-orgmode@gnu.org tsd@tsdye.com (Thomas S. Dye) writes: Thanks, it's clear to me with the difference between "value" and "output" now. whether there is a way to tell emacs-lisp that "123456789123456789" is a string rather than a number. emacs-lisp handles the output as expected if the c1 has any character other than numbers as the following. ,---- | #+BEGIN_SRC R | df <- data.frame(c1="c123456789123456789",c2=2) | df$c1 <- as.vector(df$c1) | df | #+END_SRC | | #+RESULTS: | | c123456789123456789 | 2 | | `---- > Aloha Eric, > > Eric Luo 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,