How to use R Inside Emacs

How To Use R Inside Emacs

With Aquamacs Emacs, the way to use R involves visiting a file whose extension is .r, e.g., myproj.r.

Whenever you are looking at a file with a .r extension, the Emacs menu bar at the top of the screen will have an item: ESS.

To start an R process click these in the menu bar: > ESS > Start Process > R

To execute some R code from an Emacs file, use C-c C-c

For example, put the cursor at the end of the line of R code below and type the command. Make sure the code is set apart from the rest of the file by a blank line.

x <- 1:5; x

It should have evaluated the vector from 1 to 5, and printed it in Emacs's R console buffer.