[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] R code block produces only partial output
From: |
John Hendy |
Subject: |
Re: [O] R code block produces only partial output |
Date: |
Mon, 4 Aug 2014 23:00:23 -0500 |
On Mon, Aug 4, 2014 at 7:46 PM, Andreas Kiermeier
<address@hidden> 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
- [O] R code block produces only partial output, Andreas Kiermeier, 2014/08/04
- Re: [O] R code block produces only partial output, Eric Schulte, 2014/08/04
- Re: [O] R code block produces only partial output, Charles Berry, 2014/08/05
- Re: [O] R code block produces only partial output, Eric Schulte, 2014/08/05
- Re: [O] R code block produces only partial output, John Hendy, 2014/08/05
- Re: [O] R code block produces only partial output, Nick Dokos, 2014/08/05
- Re: [O] R code block produces only partial output, Nick Dokos, 2014/08/05
- Re: [O] R code block produces only partial output, Charles C. Berry, 2014/08/05
- Re: [O] R code block produces only partial output, Aaron Ecay, 2014/08/05
- Re: [O] R code block produces only partial output, Eric Schulte, 2014/08/06
- Re: [O] R code block produces only partial output, Aaron Ecay, 2014/08/07