emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] R code block produces only partial output


From: Eric Schulte
Subject: Re: [O] R code block produces only partial output
Date: Mon, 04 Aug 2014 07:53:07 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

Hi Andreas,

Why are you setting the output type to "graphics" when you are trying to
return text?  I think that may be the source of your problem.

Best,
Eric

Andreas Kiermeier <address@hidden> writes:

> 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
>  )
>

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D (see https://u.fsf.org/yw)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]