Setting up emacs org-mode babel for R on Ubuntu

January 7, 2013
By

(This article was first published on Ecological Modelling... » R, and kindly contributed to R-bloggers)

I installed org-mode seperately, since I had troubles with its default setting (similar to the problems described here).

sudo apt-get install org-mode

Next I download and installed ESS

cd ~/.emacs.d/
wget http://ess.r-project.org/downloads/ess/ess-12.09-1.zip
unzip ess-12.09-1.zip
rm ess-12.09-1.zip

Finally I had to add the following lines to my .emacs file:

(add-to-list 'load-path "~/.emacs.d/ess-12.09-1/lisp")
(require 'ess-site)
(org-babel-do-load-languages
'org-babel-load-languages
'((R . t)))

and to my .Rprofile

old options(defaultPackages = c(old, "tikzDevice"))

For testing open a new file with emacs:

emacs test.org

and add the following code block:

#+begin_src R
date()
#+end_src

press C-c C-c to execute the code. See the org-mode documentation for more information.


To leave a comment for the author, please follow the link and comment on his blog: Ecological Modelling... » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.