From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Hendy Subject: Re: R code block produces only partial output Date: Mon, 4 Aug 2014 23:00:23 -0500 Message-ID: References: <87iom8zd24.fsf@gmail.com> <877g2oz9gv.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43980) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEVvH-0004Tm-E5 for Emacs-orgmode@gnu.org; Tue, 05 Aug 2014 00:00:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEVvF-0000qA-QB for Emacs-orgmode@gnu.org; Tue, 05 Aug 2014 00:00:27 -0400 Received: from mail-lb0-x230.google.com ([2a00:1450:4010:c04::230]:48969) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEVvF-0000py-Hg for Emacs-orgmode@gnu.org; Tue, 05 Aug 2014 00:00:25 -0400 Received: by mail-lb0-f176.google.com with SMTP id u10so257491lbd.7 for ; Mon, 04 Aug 2014 21:00:23 -0700 (PDT) In-Reply-To: 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: Andreas Kiermeier Cc: emacs-orgmode , Eric Schulte On Mon, Aug 4, 2014 at 7:46 PM, Andreas Kiermeier wrote: > Hi Eric, > I'm running Org 8.2.7c (via ELPA) and ESS 14.05. > I've tried to run with a minimal Org setup using only the following in > my init file. > The shortcut I use to start Emacs (on Windows 8.1) is: > C:\emacs\bin\runemacs.exe -Q -l "C:\emacs\bin\minimal-org.el" > > However, the results are the same as before. Any thoughts on what else > I could try? > [snip] I can reproduce with a minimal config and on Linux (to toss in a confirmation). I *also* accidentally just stumbled on a way I can toggle the behavior between correct and incorrect! It arose because my file was not able to use the #+PROPERTY settings you have -- my results were not obeying what I had set. I looked around and believe the syntax is correct per this page: - http://orgmode.org/manual/Header-arguments-in-Org-mode-properties.html However, I guarantee that the results weren't updating to ":results output drawer" as I had them set. I also noticed that the "header-args:R :session *R*" also didn't seem to be working, as if I changed the name, Emacs wouldn't ask me if I wanted to create a new R session upon block execution. Here's what I've found: Correct results: #+begin_src org #+STARTUP: showall indent hidestars #+PROPERTY: header-args:R :session r #+BEGIN_SRC R :results output drawer require(rms) set.seed(123) x <- rnorm(100) describe(x) #+END_SRC #+RESULTS: :RESULTS: x n missing unique Mean .05 .10 .25 .50 100 0 100 0.09041 -1.26508 -1.06822 -0.49385 0.06176 .75 .90 .95 0.69182 1.26450 1.56653 lowest : -2.309 -1.967 -1.687 -1.549 -1.265 highest: 1.715 1.787 2.050 2.169 2.187 :END: #+end_src Incorrect results: #+begin_src org #+STARTUP: showall indent hidestars #+BEGIN_SRC R :session r :results output drawer require(rms) set.seed(123) x <- rnorm(100) describe(x) #+END_SRC #+RESULTS: :RESULTS: 75 .90 .95 0.69182 1.26450 1.56653 lowest : -2.309 -1.967 -1.687 -1.549 -1.265 highest: 1.715 1.787 2.050 2.169 2.187 :END: #+end_src The reason, I think, is this (also correct): #+begin_src org #+STARTUP: showall indent hidestars #+BEGIN_SRC R :results output drawer require(rms) set.seed(123) x <- rnorm(100) describe(x) #+END_SRC #+RESULTS: :RESULTS: x n missing unique Mean .05 .10 .25 .50 100 0 100 0.09041 -1.26508 -1.06822 -0.49385 0.06176 .75 .90 .95 0.69182 1.26450 1.56653 lowest : -2.309 -1.967 -1.687 -1.549 -1.265 highest: 1.715 1.787 2.050 2.169 2.187 :END: #+end_src So, session settings in the #+PROPERTY config *or* no session set at all yields correct results. Again, on a fresh start the #+PROPERTY method does not ask to start a new R session. Last confirmation is that if one leaves the session #+PROPERTY line (with none in the code block) and comments out the "require(rms)" line after already having run the block, you get the error "Could not find the function 'describe'". So, there's no session activity finding the already-loaded library. The remaining questions for me is why would results differ depending on whether or not it's going through a session? Eric: this also explains why your minimal .org file couldn't reproduce: there's no setting of the session (again, not sure why that matters... but it seems to). John