emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Andreas Kiermeier <andreas.kiermeier@gmail.com>
To: Emacs-orgmode@gnu.org
Subject: R code block produces only partial output
Date: Mon, 4 Aug 2014 20:48:47 +0930	[thread overview]
Message-ID: <CAN7vk5R+2DHRajUR8+NdmWSpLhjtodrdjXOO0v027cjHY7gFxw@mail.gmail.com> (raw)

Hi all,

I've been using Org mode (latest version - see my set up below) to
perform some data analysis and have come across a problem evaluating R
code blocks. I usually use a session when working and when evaluating
a code block with describe (R package "rms") and a quantitative
variable the results in .org buffer and the *R* buffer (output)
differ. However, it's not the describe function, but something about
the output of that function. The following is a minimal example (both
with and without the describe function) to illustrate the problem.

I think it has something to do with a number of spaces followed by a
'.' in the output buffer.

Any thoughts or guidance would be greatly appreciated.

Thanks in advance.

Andreas

------- test.org ---------------------
#+STARTUP: showall indent hidestars
#+PROPERTY: header-args:R :session *R*
#+PROPERTY: header-args :results output graphics :exports both

#+BEGIN_SRC R
  require(rms)
  x <- rnorm(100)
  describe(x)
#+END_SRC

#+RESULTS:
: 75      .90      .95
:  0.69261  1.38170  1.71468
:
: lowest : -2.270 -1.878 -1.705 -1.525 -1.423
: highest:  1.739  2.032  2.061  2.150  2.480

#+BEGIN_SRC R
  x <- rnorm(100)
  y <- quantile(x, probs=seq(0,1,0.1))
  names(y) <- as.character(c("0",".1",".2",".3",".4",".5",".6",".7",".8",".9","1"))
  y
#+END_SRC

#+RESULTS:
: 6          .7          .8          .9           1
:  0.31144890  0.63292642  0.87168950  1.17596547  1.96212110
------- end test.org ---------------------


The actual output for the first code block in the *R* buffer was:

> describe(x)
x
       n  missing   unique     Mean      .05      .10      .25      .50
     100        0      100   0.1118 -1.39404 -1.02732 -0.45899  0.03756
     .75      .90      .95
 0.69261  1.38170  1.71468

lowest : -2.270 -1.878 -1.705 -1.525 -1.423
highest:  1.739  2.032  2.061  2.150  2.480


Similarly, the second code block resulted in:

> y
          0          .1          .2          .3          .4          .5
-2.23303584 -1.31137871 -0.69424743 -0.48689155 -0.16973865  0.09289862
         .6          .7          .8          .9           1
 0.31144890  0.63292642  0.87168950  1.17596547  1.96212110


And finally my set up is:

Emacs  : GNU Emacs 24.3.1 (i386-mingw-nt6.2.9200)
 of 2013-03-18 on MARVIN
Package: Org-mode version 8.2.7c (8.2.7c-elpa @
c:/Users/andre_000/Documents/.emacs.d/elpa/org-20140730/)

current state:
==============
(setq
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
org-babel-execute-safely-maybe)
 org-latex-format-headline-function 'org-latex-format-headline-default-function
 org-src-fontify-natively t
 org-html-format-inlinetask-function 'ignore
 org-completion-use-iswitchb t
 org-tab-first-hook '(org-hide-block-toggle-maybe
org-src-native-tab-command-maybe
     org-babel-hide-result-toggle-maybe org-babel-header-arg-expand)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
 org-cycle-hide-inline-tasks org-cycle-show-empty-lines
 org-optimize-window-after-visibility-change)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-confirm-babel-evaluate nil
 org-speed-command-hook '(org-speed-command-default-hook
org-babel-speed-command-hook)
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-babel-pre-tangle-hook '(save-buffer)
 org-occur-hook '(org-first-headline-recenter)
 org-src-lang-modes '(("r" . ess-mode) ("ocaml" . tuareg) ("elisp" . emacs-lisp)
     ("ditaa" . artist) ("asymptote" . asy) ("dot" . fundamental)
     ("sqlite" . sql) ("calc" . fundamental) ("C" . c) ("cpp" . c++)
     ("C++" . c++) ("screen" . shell-script))
 org-shiftdown-final-hook '(windmove-down)
 org-html-format-headline-function 'ignore
 org-log-done 'time
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-catch-invisible-edits 'smart
 org-default-notes-file "~/.org//notes.org"
 org-latex-format-drawer-function '(lambda (name contents) contents)
 org-src-tab-acts-natively t
 org-export-backends '(ascii html icalendar latex md)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-completion-use-ido t
 org-use-speed-commands t
 org-mode-hook '(#[nil "\300\301\302\303\304$\207"
  [org-add-hook change-major-mode-hook org-show-block-all append local] 5]
#[nil "\300\301\302\303\304$\207"
  [org-add-hook change-major-mode-hook org-babel-show-result-all
append local] 5]
org-babel-result-hide-spec org-babel-hide-all-hashes org-mode-reftex-setup
(lambda nil (flyspell-mode 1) (auto-fill-mode 1)
 (local-set-key "\220" (quote outline-previous-visible-heading))
 (local-set-key "\225" (quote outline-up-heading))
 (local-set-key "\227" (quote org-table-copy-region))
 (local-set-key "\231" (quote org-table-paste-rectangle))
 (local-set-key "\214" (quote org-table-sort-lines))
 (local-set-key "\311" (quote org-toggle-iimage-in-org)))
)
 org-shiftup-final-hook '(windmove-up)
 org-ascii-format-drawer-function '(lambda (name contents width) contents)
 org-directory "~/.org/"
 org-html-format-drawer-function '(lambda (name contents) contents)
 org-shiftleft-final-hook '(windmove-left)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-agenda-files '("~/.org/agenda.org")
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-todo-keyword-faces '(("WAITING" . ak-org-todo-warning-face))
 org-shiftright-final-hook '(windmove-right)
 org-babel-load-languages '((emacs-lisp) (R . t))
 org-babel-R-command "C:/Progra~1/R/R-3.1.1/bin/x64/R --slave --no-save"
 org-latex-format-inlinetask-function 'ignore
 org-confirm-shell-link-function 'yes-or-no-p
 )

             reply	other threads:[~2014-08-04 11:19 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-04 11:18 Andreas Kiermeier [this message]
2014-08-04 11:53 ` R code block produces only partial output Eric Schulte
2014-08-04 12:23   ` Andreas Kiermeier
2014-08-04 13:10     ` Eric Schulte
2014-08-05  0:46       ` Andreas Kiermeier
2014-08-05  4:00         ` John Hendy
2014-08-05  4:31           ` Andreas Kiermeier
2014-08-05 18:05       ` Charles Berry
2014-08-05 19:02         ` Eric Schulte
2014-08-05 19:11           ` John Hendy
2014-08-05 19:57             ` Nick Dokos
2014-08-05 20:10               ` Nick Dokos
2014-08-05 22:21             ` Charles C. Berry
2014-08-06  3:32           ` Aaron Ecay
2014-08-06 11:30             ` Eric Schulte
2014-08-07  6:00               ` Aaron Ecay
2014-08-07 17:42                 ` Charles C. Berry
2014-08-07 18:06                   ` Aaron Ecay
2014-08-07 18:42                     ` Charles C. Berry
2014-08-07 19:06                       ` Thomas S. Dye
2014-08-09  8:54                       ` Rainer M Krug
2014-08-16  5:05                     ` Aaron Ecay
2014-08-16 18:50                       ` Charles C. Berry
2014-08-16 20:58                         ` Aaron Ecay
2014-08-17  6:03                           ` Achim Gratz
2014-08-19  0:13                             ` Aaron Ecay
2014-08-19  5:36                               ` Achim Gratz
2014-08-23  8:32                                 ` Aaron Ecay
2014-08-23  9:24                                   ` Andreas Kiermeier
2014-08-23 17:10                                   ` Aaron Ecay
2014-08-23 18:35                                   ` Thomas S. Dye
2014-08-23 19:37                                     ` Ista Zahn
2014-08-24  0:10                           ` Charles C. Berry
2014-08-28  5:24                             ` Aaron Ecay
2014-09-01  5:00                               ` Aaron Ecay
2014-09-01 16:08                                 ` Charles C. Berry
2014-08-09  8:48                   ` Rainer M Krug
2014-08-06  1:11         ` Andreas Kiermeier
2014-08-06  2:21           ` Charles C. Berry
2014-08-06  3:24             ` Aaron Ecay
2014-08-06 15:59               ` Charles C. Berry

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=CAN7vk5R+2DHRajUR8+NdmWSpLhjtodrdjXOO0v027cjHY7gFxw@mail.gmail.com \
    --to=andreas.kiermeier@gmail.com \
    --cc=Emacs-orgmode@gnu.org \
    /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).