Saturday, September 3, 2011

R and Emacs

R is a language specialized for statistics.





This is a quick guide to start using R from Emacs:






1. Install R (http://cran.r-project.org/manuals.html)

2. Install ESS (Emacs Speaks Statistics) package for Emacs. It is available as a package in most distros:

In Ubuntu
$ sudo apt-get install ess

To install in your environment, check Downloads in ESS site: http://ess.r-project.org

3. Open .R file to turn on ESS mode in Emacs

4. To open R shell in inferior mode:

M-x inferior-ess

This will start a shell where you can run R interactively.

5. To evaluate an expression in buffer in R console, select the expression or block in Emacs (Ctrl+Space and arrow keys) and C-c C-r

Follow the instructions here to evaluate using just Shift+Enter:
http://www.kieranhealy.org/blog/archives/2009/10/12/make-shift-enter-do-a-lot-in-ess/