ESS

How to install ESS from Emacs

 1. create/visit (C-x C-f) file .emacs with following:

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize) 

2. Evaluate the buffer by any of these: 

    1) run Evaluate buffer from Emacs-Lisp menu or by entering M-x eval-buffer

    2) place cursor at the end of each line right behind the closing paren and 

        2)a) run Evaluate last S-expression from Emacs-Lisp menu or 

        2)b) press C-x C-e

if something did not work you will be put in an errors buffer called *Backtrace*

3. run M-x package-refresh-contents 

3. close emacs and re-open emacs.

run  M-x package-list-packages

4. either scroll to ess or search by C-s for Statistics. It will land on another package first, so enter C-s again and again until you land on ess. Press i to mark for installation. Then search for poly. Mark poly-R, poly-markdown, poly-org and polymode packages and mark with an i. then press x to install. Additional details on polymode can be found at: https://polymode.github.io/installation/

5. Open .emacs and add the following:

(require 'ess-site) ;; this may not be necessary with emacs> 27.1
(require 'org)

(defun rmd-mode ()
  "ESS Markdown mode for rmd files"
  (interactive)
  (require 'poly-R)
  (require 'poly-markdown)    
  (poly-markdown+r-mode))
(add-to-list 'auto-mode-alist '("\\.md" . poly-markdown-mode))
(add-to-list 'auto-mode-alist '("\\.Snw" . poly-noweb+r-mode))
(add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
(add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))

save and close emacs. Re-open emacs and check if there are any errors. You should have a *ESS* buffer now in the list of buffers.


Comments