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 .Rprofile:

Use ESS to step through evaluation line-by-line

Use C-c C-c to execute the block

Use C-c ' to visit the edit buffer for your code block

Use ess-eval-line-and-step 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