R Source Code Blocks in Org Mode

Posted by:

Setup and configuration

Adapted from org-mode official site.

  1. Install R with binary or source code Comprehensive R Archive Network for Arch Linux, following documents here.

  2. Install ESS (Emacs Speak Statistics) Mode

    Follow instruction here.

  3. Finally, you’ll need to ensure that org-babel-load-languages includes an entry for R.

  4. Org Mode supports graphical output for LaTeX documents using the PGF and TikZ graphics system for TeX. In order to use this facility your R installation will need the tikzDevice package. One way to ensure that this device is loaded is to put the following lines in {php}.Rprofile{/php}:

Use ESS to step through evaluation line-by-line

Use {php}C-c C-c{/php} to execute the block

Use {php}C-c ‘{/php} to visit the edit buffer for your code block

Use {php}ess-eval-line-and-step{/php} to evaluate each line in turn

Header arguments for output

  1. does not produce a file -as you see it does here?

    1.png

  2. does produce a file, by printing object

    2.png

  3. does produce a file, by using :results output

    3.png

  4. does produce a file, by evaluating in :session

    4.png

share var across blocks

4.png

Org Mode Output

from R with Ascii package

from org-mode R block

latex code from R

0
  Related Posts

Add a Comment