Integrating Emacs and R

Download the Emacs Speaks Statistics package.

  1. Go to (website is hosted in Switzerland) and download the latest Emacs Speaks Statistics package by right-clicking on the latest version Save to a directory that's easy to find.
  2. Extract to c:\program files\emacs\site-lisp
  3. Rename the directory c:\program files\emacs\site-lisp\ess-x.x.x to c:\program files\emacs\site-lisp\ess
  4. Add the bin directory of the R package to the PATH environment variable. For example, I used R-2.6.0-win32.exe to install R, hence I added c:\program files\R\R-2.6.0\bin to the end of the PATH environment variable. Note that this may be different depending on the version of R you've installed. Navigate to the directory to make sure you have it right. Otherwise, R will not be integrated with Emacs.
  5. Add the following lines to your _emacs file, (you can use this one if you don't have a _emacs file yet.) The _emacs file should be placed where the HOME environment variable points to. Change the following line depending on where you installed emacs to. (Note: You must use forward slashes to describe the path in the _emacs file, and not the usual back slashes typically used to describe Windows file paths).
          (add-to-list 'load-path "c:/program files/emacs/site-lisp/ess/lisp")
          (require 'ess-site)
  6. Speeding up Emacs: To speed up emacs, you can compile the ESS package. To do so, you need to enter some key combinations in an Emacs window. Enter the following: (Click on the link for more detailed instructions)
          C-u 0 M-x byte-recompile-directory c:\program files\emacs\site-lisp
  7. Start Emacs and test to see if the integration with R works. Press M-x and enter a capital R, then press enter. Give it a name of a working directory to use and the command prompt should appear in emacs. Type demo(graphics) for a pretty nice demo of the graphics capabilities of R.
S. Hyde
Last modified: Tue Sep 8 18:14:53 HST 2020